0.99.x 版本之后的变更#

  • 默认情况下,matplotlib.axes.Axes.set_xlim()matplotlib.axes.Axes.set_ylim()matplotlib.axes.Axes.axis() 及其对应的 pyplot 函数的行为已更改:当使用这些方法显式设置视图限制时,匹配轴的自动缩放功能将被关闭。现在可以使用新的 auto kwarg 来控制此行为。限制 kwargs 的名称已更改为 leftright,而不是 xminxmax,以及 bottomtop,而不是 yminymax。不过,旧名称仍然可以使用。

  • 有五个新的 Axes 方法及其对应的 pyplot 函数,用于方便地进行自动缩放、刻度位置、刻度标签格式化,以及刻度和刻度标签的总体外观:

  • 方法 matplotlib.axes.Axes.bar() 接受一个 error_kw 关键字参数;它是一个字典,包含要传递给 errorbar 函数的 kwargs。

  • 现在,matplotlib.axes.Axes.hist()color 关键字参数接受一个颜色规格序列,以匹配数据集序列。

  • The EllipseCollection 已经以两种方式进行了更改:

    • 有一个新的 units 选项,'xy',它根据数据单位缩放椭圆。这与 :class:'~matplotlib.patches.Ellipse` 的缩放相匹配。

    • heightwidth kwargs 已更改为指定高度和宽度,以与 Ellipse 保持一致,并更好地匹配它们的名称;以前它们指定的是半高度和半宽度。

  • 有一个新的 rc 参数 axes.color_cycle,并且颜色循环现在独立于 rc 参数 lines.colormatplotlib.Axes.set_default_color_cycle 已被弃用。

  • 你现在可以将多个图形打印到一个PDF文件中,并修改PDF文件的文档信息字典。更多信息请参阅类 matplotlib.backends.backend_pdf.PdfPages 的文档字符串。

  • 移除了仅由实验性 traited 配置所需的 configobjenthought.traits 包,这些包有些过时。如有需要,请单独安装。

  • 新的 rc 参数 savefig.extension 设置了当 matplotlib.figure.Figure.savefig()fname 参数缺少扩展名时所使用的文件名扩展名。

  • 为了简化后端API,所有裁剪矩形和路径现在都使用GraphicsContext对象传递,即使在集合和图像中也是如此。因此:

    draw_path_collection(self, master_transform, cliprect, clippath,
                         clippath_trans, paths, all_transforms, offsets,
                         offsetTrans, facecolors, edgecolors, linewidths,
                         linestyles, antialiaseds, urls)
    
    # is now
    
    draw_path_collection(self, gc, master_transform, paths, all_transforms,
                         offsets, offsetTrans, facecolors, edgecolors,
                         linewidths, linestyles, antialiaseds, urls)
    
    
    draw_quad_mesh(self, master_transform, cliprect, clippath,
                   clippath_trans, meshWidth, meshHeight, coordinates,
                   offsets, offsetTrans, facecolors, antialiased,
                   showedges)
    
    # is now
    
    draw_quad_mesh(self, gc, master_transform, meshWidth, meshHeight,
                   coordinates, offsets, offsetTrans, facecolors,
                   antialiased, showedges)
    
    
    draw_image(self, x, y, im, bbox, clippath=None, clippath_trans=None)
    
    # is now
    
    draw_image(self, gc, x, y, im)
    
  • 有四种新的 Axes 方法及其对应的 pyplot 函数,用于处理非结构化的三角网格: