【问题标题】:more than 9 subplots in matplotlibmatplotlib 中超过 9 个子图
【发布时间】:2011-05-08 16:28:00
【问题描述】:

matplotlib 中是否可以得到 9 个以上的子图?

我正在使用 subplots 命令 pylab.subplot(449); 我怎样才能让 4410 工作?

非常感谢。

【问题讨论】:

    标签: python charts matplotlib


    【解决方案1】:

    这比我预期的要容易,我刚刚做到了:pylab.subplot(4,4,10) 并且成功了。

    【讨论】:

      【解决方案2】:

      你也可以用 pyplot 这样做:

      import matplotlib.pyplot as plt
      oFig1 = plt.figure(1)
      
      oFig1.add_subplot(4,4,11)      #(m,n,x) -> x starts with 1
      ...
      

      【讨论】:

        【解决方案3】:

        你也可以这样做

        import matplotlib.pyplot as plt
        
        N = 10 # number of subplots you want
        fig, axes = plt.subplots(nrows = N)
        

        然后是len(axes) = N,这意味着您将有一个轴供每个子图使用。

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2020-07-24
          • 2010-11-26
          • 2018-01-17
          • 1970-01-01
          相关资源
          最近更新 更多