【问题标题】:how to make plot where curves may overlap?如何绘制曲线可能重叠的图?
【发布时间】:2013-02-10 17:40:01
【问题描述】:

我正在尝试制作与此类似的情节

因为有完全重叠的曲线,我喜欢他把图例放在曲线上的方式,所以他可以画出这么多曲线而不会造成混乱,并且有一个单独的图显示这些图例代表什么。

当我试图在 Matlab 中制作这个情节时,但我不知道如何制作这样的图例。而且带网格的双对数也是一团糟。

如何使用 matplotlib 或 Matlab 制作此图? matplotlib 是否更灵活?

【问题讨论】:

  • 你可以用annotate来做到这一点

标签: python matlab matplotlib plot legend


【解决方案1】:

只需使用annotate,这应该可以让你达到 90%:

x = np.linspace(0,1000)
y = x ** -2

figure()
ax = gca()
ax.loglog(x,y)
ax.grid(True)
ax.grid(True, which='minor')

ax.annotate('a1', (x[15], y[15]),
            backgroundcolor='w',
            color='b',
            va='center',
            ha='center',
            bbox=dict(boxstyle="round", color='b'),)

annotate docexamples。获得圈子可能会很棘手。如果你真的想使用圆圈,我建议在 github 上提交功能请求。 (看起来像几个小时的挖掘 mpl 胆量来添加椭圆边界框)。

【讨论】:

  • 有趣,我不知道你可以用轴对象ax.loglog(x,y)来绘制。
猜你喜欢
  • 1970-01-01
  • 2017-01-03
  • 1970-01-01
  • 2019-10-20
  • 2011-03-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多