zoukankan      html  css  js  c++  java
  • matplotlib 高级用法实例--共享x轴

    http://localhost:8888/notebooks/duanqs/matplotlib_advanced_example.ipynb

    我不会弄呀, 刚才从matplotlib文档里吧示例用jupyter notebook跑了一遍, 很不错的笔记. 

    如何才能把它写到博客里呢. 

    python代码和mk代码混合在一起了, 很难看呀!!!

     1 Our Favorite Recipes — Matplotlib 1.5.1 documentation
     2 http://matplotlib.org/users/recipes.html
     3 Our Favorite Recipes
     4 Here is a collection of short tutorials, examples and code snippets that illustrate some of the useful idioms and tricks to make snazzier figures and overcome some matplotlib warts.
     5 Sharing axis limits and views It’s common to make two or more plots which share an axis, e.g., two subplots with time as a common axis. When you pan and zoom around on one, you want the other to move around with you. To facilitate this, matplotlib Axes support a sharex and sharey attribute. When you create a subplot() or axes() instance, you can pass in a keyword indicating what axes you want to share with
     6 In [1]:
     7 
     8 import matplotlib 
     9 import numpy as np
    10 import matplotlib.pyplot as plt
    11 %matplotlib inline
    12 import matplotlib 
    13 In [2]:
    14 
    15 t = np.arange(0, 10, 0.01)
    16 17 ax1 = plt.subplot(211)
    18 ax1.plot(t, np.sin(2*np.pi*t))
    19 20 ax2 = plt.subplot(212, sharex=ax1)
    21 ax2.plot(t, np.sin(4*np.pi*t))
    22 Out[2]: 
    23 [<matplotlib.lines.Line2D at 0x559b710>]

    
    
  • 相关阅读:
    我来悟微服务(1)-夜观天象
    静夜思-十年总结与展望
    【Orleans开胃菜系列2】连接Connect源码简易分析
    【Orleans开胃菜系列1】不要被表象迷惑
    .Net单元测试业务实践
    未能使用“Csc”任务的输入参数初始化该任务
    面试发散思维
    Linux部署DotNetCore记录
    一步一步来熟悉Akka.Net(一)
    午夜杂谈
  • 原文地址:https://www.cnblogs.com/duan-qs/p/5750936.html
Copyright © 2011-2022 走看看