我在试着画一个椭圆。
ax = plt.subplot(111)
ellipse = Ellipse(mean1L, ellipse_x, ellipse_y, angle=theta)
ax.add_artist(ellipse)
plt.show()每一个论点看起来都很好,但它并没有出现。我做错了什么?
发布于 2018-03-05 23:34:40
椭圆超出了轴的限制。
而不是ax.add_artist(ellipse),您更愿意使用
ax.add_patch(ellipse)为了能够轻松地调整添加的面片的轴限制。这将允许稍后调用ax.autoscale_view()自动调整轴限制。
import matplotlib.pyplot as plt
from matplotlib.patches import Ellipse
ax = plt.subplot(111)
ellipse = Ellipse((2,2), 1,1.5 , angle=60)
ax.add_patch(ellipse)
ax.autoscale_view()
plt.show()

https://stackoverflow.com/questions/49113813
复制相似问题