Thanks to visit codestin.com
Credit goes to github.com

Skip to content

tutorial on how autoscaling works #17417

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
tacaswell opened this issue May 15, 2020 · 9 comments · Fixed by #18840
Closed

tutorial on how autoscaling works #17417

tacaswell opened this issue May 15, 2020 · 9 comments · Fixed by #18840
Labels
Documentation Good first issue Open a pull request against these issues if there are no active ones!
Milestone

Comments

@tacaswell
Copy link
Member

But I'd settle for some better/less tautological documentation for how autoscale is supposed to work :)

Originally posted by @mwaskom in #17331 (comment)

We need a long-form tutorial like https://matplotlib.org/tutorials/intermediate/imshow_extent.html for autoscaling. This needs to cover

  • margins
  • 'sticky edges'
  • what artists participate
  • when / how the bounding boxes are collected
  • what implicitly disables autoscaling
  • how to explicitly enable / disable autoscaling
  • when and how you need to manually kick off the autoscaling
  • how to "manually" get the same effect
@story645 story645 added Documentation Good first issue Open a pull request against these issues if there are no active ones! labels May 15, 2020
@Tillsten
Copy link
Contributor

I would add:

  • How to autoscale one axis only within the view limits of the other coordinate.

@sarthakforwet
Copy link

Hey, I wanna work on this issue.. Could you please assign it to me?
And also I am quite not getting what

what artists participate

means.

@tacaswell
Copy link
Member Author

@sarthakforwet If you are interested in working on this please do so and open a PR, we do not really "assign" work.

Not all of the artists associated with the axes are taken into account when deciding what the data limits are, see

def relim(self, visible_only=False):
"""
Recompute the data limits based on current artists.
At present, `~.Collection` instances are not supported.
Parameters
----------
visible_only : bool, default: False
Whether to exclude invisible artists.
"""
# Collections are deliberately not supported (yet); see
# the TODO note in artists.py.
self.dataLim.ignore(True)
self.dataLim.set_points(mtransforms.Bbox.null().get_points())
self.ignore_existing_data_limits = True
for line in self.lines:
if not visible_only or line.get_visible():
self._update_line_limits(line)
for p in self.patches:
if not visible_only or p.get_visible():
self._update_patch_limits(p)
for image in self.images:
if not visible_only or image.get_visible():
self._update_image_limits(image)

@sarthakforwet
Copy link

Hey @tacaswell . I know autoscaling is not supported by Collection objects such as EllipseCollection,LineCollection,PatchCollection etc. but certainly not getting the answer for what implicitly disables it.

o how to explicitly enable / disable autoscaling
o when and how you need to manually kick off the autoscaling

Are you trying to say that in the first one describe for pyplot.autoscale(enable = True/False) and
in the second discuss a use-case when we want not to autoscale and hence disable it?

o how to "manually" get the same effect

By manually getting the same effect you mean setting xlim and ylim manually to scale according to data right ?

@tacaswell
Copy link
Member Author

how to explicitly enable / disable autoscaling

Yes, but the tutorial should start at the Axes level

when and how you need to manually kick off the autoscaling

If you update the data in an artist you may need to "manually" update what the Axes thinks its data limits are

how to "manually" get the same effect

I was thinking what series of methods would the user need to call to replicate what autoscaling does when a new artist is added, but going through how to, given a set of artists, compute what the limits would be also sounds super useful!

@sarthakforwet
Copy link

@tacaswell Okay and what implicitly disables autoscalling?

@sarthakforwet
Copy link

@tacaswell I have made the tutorial but some things are not covered and I have searched but did not get how to do that so should i submit the PR for you to review it or first share it via other medium and finally submit a completed tutorial ?

@tacaswell
Copy link
Member Author

We try to run all of our contributions / review through github so please open a (draft) PR.

Some of these things are not currently documented so part of the work here is to dig into the source and describe what it is doing ;)

@ianhi
Copy link
Contributor

ianhi commented Aug 20, 2020

I have two thoughts to add

     At present, `~.Collection` instances are not supported. 
  1. Can what relim is/does also be added to such a tutorial. I don't really understand the difference or how I could achieve something similar with a collection.

  2. It would be cool if https://matplotlib.org/gallery/api/collections.html was updated in concert with this. I found that reading that has muddied the waters on relim/autoscale for me. Sometimes autoscale_view does apply to collections, but maybe not relim? And there is a difference between offsets and transOffsets?

@QuLogic QuLogic added this to the v3.4.0 milestone Dec 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Good first issue Open a pull request against these issues if there are no active ones!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants