Description
Problem
This is two fold, first is the initial motivation for this issue and second is the general problem that the first is a microcosm of:
1.
Axes objects have a boolean attribute ignore_existing_data_limits
that returns no results when searched for on the docs: https://matplotlib.org/3.3.1/search.html?q=ignore_existing_data_limits
This variable is important for using relim
and autoscale_view
when updating the offsets of a scatterplot as can be seen in this SO answer: https://stackoverflow.com/a/51327480/835607. There is also a comment on that answer wondering what the purpose of ax.ignore_existing_data_limits = True
is.
2.
More generally, there is not much documentation on how to update the view extent/datalims of an axis after adding artists or collections. What there is can at times be confusing someone (i.e. me) trying to work through how to dynamically update plots. For example, the docstring of relim
says that it will not work for collections but it's not clear what I should use instead of relim. But I know from pyplot functions such as hist
and scatter
it is clear that it is possible to update the datalims to account for collections.
Suggested Improvement
It would be awesome to have a tutorial dedicated to explaining the interactions between and how to use all of the following:
relim
autoscale
autoscale_view
datalim
xlim/ylim
other things I don't know about yet
basically a tutorial that could be used a one stop shop for understanding how to automatically update the view extent of an axis to match any updates that might be applied either via interaction or an animation.