errorbars_and_boxes
使用PatchCollection在误差图中创建箱型图
在这个例子中,我们通过在x方向和y方向上添加由条形极限定义的矩形块来拼写一个非常标准的误差条形图。为此,我们必须编写自己的自定义函数 make_error_boxes。仔细检查此函数将揭示matplotlib编写函数的首选模式:
- an Axes object is passed directly to the function
- the function operates on the Axes methods directly, not through the
pyplotinterface - plotting kwargs that could be abbreviated are spelled out for better code readability in the future (for example we use
facecolorinstead of fc) - the artists returned by the Axes plotting methods are then returned by the function so that, if desired, their styles can be modified later outside of the function (they are not modified in this example).

1 | import numpy as np |
下载这个示例
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来源 Estom的博客!










