Python & Matplotlib: wie zu zeichnen ellipse?

Kann ich plot ellipse so:

from matplotlib.patches import Ellipse
import matplotlib as mpl
%matplotlib inline
from matplotlib import pyplot as plt

mean = [ 19.92977907 ,  5.07380955]
width = 30
height = 1.01828848
angle = -54
ell = mpl.patches.Ellipse(xy=mean, width=width, height=height, angle = 180+angle)
fig, ax = plt.subplots()
ax.add_artist(ell)

ax.set_aspect('equal')
ax.set_xlim(-100, 100)
ax.set_ylim(-100, 100)
plt.show()

Jedoch, das verlangt, dass ich die Achse Daten-Grenzwerte manuell eingeben. Es kann automatisch eingestellt werden? Ich meine, wie man loswerden ax.set_xlim(-100, 100) und ax.set_ylim(-100, 100)?
Oder, was ist eine gute Art zu zeichnen ellipse?

  • Ich verstehe nicht das problem. Sie haben einige arbeiten code...
  • Ich möchte nicht xlimt manuell, wie kann ich es tun?
  • OK, ich sehe. Das ist klarer. Siehe meine Antwort - Sie brauchen, um zu verwenden add_patch richtig Daten abrufen, die Grenzen
InformationsquelleAutor cqcn1991 | 2015-09-03
Schreibe einen Kommentar