[Matplotlib-users] Autoscaling after adding patches (and annotations)

Neal Becker ndbecker2 at gmail.com
Fri Mar 22 06:51:54 EDT 2019


Yes, that doesn't work.  It just autoscales to a tiny portion of the data.

In my example, I generate the xy coordinates for the centers of hexagons
that tile a square area.  The code adds the hexagons using add_artist.
Also, the centers of the hexagons are annotated.  Neither of these
operations causes the axes to scale correctly.  If I add a step to plot the
centers of the hexagons, using e.g., scatter, then the axes are scaled
correctly.
For now, I'm just adding the scatter plot with alpha=0 to get the scaling
correct.
But I still don't know a less klugey way to do it.

On Fri, Mar 22, 2019 at 12:43 AM Juan Nunez-Iglesias <jni.soma at gmail.com>
wrote:

> What's an
> easy way to get the axes to scale correctly in this example?
>
>
> Have you tried `ax.autoscale_view`?
>
> https://matplotlib.org/api/_as_gen/matplotlib.axes.Axes.autoscale_view.html
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20190322/4fb235ae/attachment.html>


More information about the Matplotlib-users mailing list