FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Bbox.frozen() does not copy minposx/minposy · Issue #19296 · matplotlib/matplotlib · GitHub

Repository navigation

Bbox.frozen() does not copy minposx/minposy #19296

Closed

Description

Bug report

Bug summary

All's in the title.

One use case which showcases this is to prevent an artist from participating in autoscaling (in effect, a slightly hackish way to implement something like #15595):

ax = ...
dl = ax.dataLim.frozen()
ax.plot(...)
# restore old datalim, so that plot() does not participate in autoscale
ax.dataLim = dl

which works... except for log-scale, as that needs also copying minposx/minposy.

Code for reproduction

from pylab import *
plot([1, 2]); print(gca().dataLim.minposx, gca().dataLim.frozen().minposx)

Actual outcome

1.0 inf

Expected outcome

1.0 1.0

Matplotlib version

  • Operating system: linux
  • Matplotlib version (import matplotlib; print(matplotlib.__version__)): master (3.3.x)
  • Matplotlib backend (print(matplotlib.get_backend())): any
  • Python version: 3.9
  • Jupyter version (if applicable):
  • Other libraries:

Activity

  1. added
    🌱 Good first issueOpen a pull request against these issues if there are no active ones!
    on Jan 14, 2021
  2. Monishver commented on Jan 18, 2021

    Hello @anntzer , I'm new to open source, and would like to contribute to this issue, could you explain this issue more and navigate me a little bit.

  3. story645 commented on Jan 18, 2021

    Member

    hi @Monishver! check out our development guide at https://matplotlib.org/devdocs/

    The issue is that the method frozen on BBoxes parent

    def frozen(self):
    return Bbox(self.get_points().copy())
    frozen.__doc__ = TransformNode.__doc__
    does not include the minposx/minposy properties of the BBox child class when it makes its copy.

    One possible solution is for Bbox to implement its own frozen method but there are probably others.

  4. Monishver commented on Jan 19, 2021

    Thanks for giving a detailed overview, I have started looking into it and will try to implement it in few days.

  5. story645 commented on Jan 26, 2021

    Member

    If you overload 'frozen' by implementing it inside BBox, than you can add whichever of BBox's attributes (such as miniposx and minposy) to the attributes returned in the frozen version.

    Another option is extending BBox.get_points but I don't like that approach since miniposx and miniposy aren't points.

  6. added
    Difficulty: Easyhttps://matplotlib.org/devdocs/devel/contribute.html#good-first-issues
    and removed
    🌱 Good first issueOpen a pull request against these issues if there are no active ones!
    on Jan 26, 2021
  7. jklymak commented on Jan 26, 2021

    Member

    I've reclassified this - I don't think anything that touches the minpos machinery is a "Good first issue". Maybe its "Easy" if you know what minpos is and understand its use in the library, but given that it is almost undocumented, that requires digging through the code. Thats not to preclude this being a "first issue", but first time contributors should expect to do said digging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL