我试图画出类似的东西:
主要思想是在某个特定范围内绘制不同颜色的椭圆,例如[-6,6]。
我了解可以使用plt.contour
函数。但我不明白如何生成线。
答案 0 :(得分:3)
我个人不会对轮廓进行此操作,因为您需要添加我认为不需要的高程信息?
matplotlib
有Ellipse
,它是Artist
的子类。以下示例将单个椭圆添加到绘图中。
import matplotlib as mpl
ellipse = mpl.patches.Ellipse(xy=(0, 0), width=2.0, height=1.0)
fig, ax = plt.subplots()
fig.gca().add_artist(ellipse)
ax.set_aspect('equal')
ax.set_xlim(-2, 2)
ax.set_ylim(-2, 2)
然后你需要研究如何获得你想要的效果,我会have a read of the docs通常会让事情变得透明alpha
。