2013-10-12 190 views
2

我试图绘制类似的东西: enter image description herematplotlib绘制椭圆轮廓​​

的主要思想是从绘制不同颜色的椭圆在一些特定的范围内,例如[-6,6]。我知道plt.contour函数可以使用。但我不明白如何生成线条。

回答

3

我个人不会用轮廓做这个,因为你需要添加关于我认为你不想要的高程的信息?

matplotlibEllipse它是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) 

enter image description here

然后,您需要研究如何让你在寻找什么,我会have a read of the docs一般使事情透明是通过alpha完成的效果。