[Matplotlib-users] Autoscaling after adding patches (and annotations)
Neal Becker
ndbecker2 at gmail.com
Thu Mar 21 10:44:31 EDT 2019
In this code, I add polygons and text annotations. The result is plotted on
axes scaled [0..1], not autoscaled to match the data. If I add e.g., a
scatterplot of the polygon centers, the result in scaled fine. What's an
easy way to get the axes to scale correctly in this example?
for i, center in enumerate(centers):
circle = mpl.patches.RegularPolygon ((center.real, center.imag), 6, 1,
fill=False, clip_on=False, linestyle='-', orientation=30*pi/180)
ax.add_artist (circle)
ax.annotate (beam_colors[i], xy=(center.real, center.imag),
textcoords='offset points', xytext=(-3,3))
plt.show()
More information about the Matplotlib-users
mailing list