For all types plots I've seen so far, matplotlib
will automatically center them when no xlim(), ylim()
values are given. Example:
import matplotlib.pyplot as plt
A_pts = [(162.5, 137.5), (211.0, 158.3), (89.6, 133.7)]
ax = plt.subplot(111)
ax.scatter(*A_pts)
plt.show()
But when I plot a Polygon
ax = plt.subplot(111)
triangle = plt.Polygon(A_pts, fill=None, edgecolor='r')
ax.add_patch(triangle)
plt.show()
the plot window is shown with limits [0, 1]
for both axis, which results in the polygon not being visible. I have to explicitly pass proper limits so that it will show in the plot window
ax.set_xlim(80, 250)
ax.set_ylim(120, 170)
Is this by design or am I missing something?