Skip to content

axes.xmargin/ymargin rcParam behaves differently than pyplot.margins() #2298

Closed

Description

@funnell

When setting the axes.xmargin paramter in my matplotlibrc file to say, 0.05, the margins are increased by much more than 0.05. If I adjust the margins using pyplot.margins(0.05) then I see the expected behaviour.
This seems to be related to the 'tight' parameter in the margins function as setting tight=False reproduces the behaviour of setting the axes.xmargin rcParam.

I suggest having the axes.xmargin/ymargin rcParams behave the same way as the default behaviour of pyplot.margins by having autoscale(tight=True) be run when setting these rcParams. Otherwise, perhaps an autoscale rcParam might be useful?

Activity

  1. tacaswell commented on Apr 3, 2014

    @tacaswell
    Member

    @funnell Sorry it took so long for anyone to respond to this. Your comments are exactly right.

    Changing the behavior of the rcparam seems like an api break, but we are about to release 1.4 and this is probably minor enough to be ok. Adding yet another rcparam would get around that problem, but adds yet another rcparam. I am leaning towards adding axes.margin_autoscale.

    Anyone else have thoughts?

  2. efiring commented on Apr 3, 2014

    @efiring
    Member

    Even though this seems like a small thing, we need to come up with a reasonable array of alternatives. What values would axes.margin_autoscale take, and how would its effect be implemented?
    All this is complicated by the fact that Axes has a single _tight attribute rather than a _tight_x and a _tight_y, and there are many "autoscale*" attributes and methods--it can get confusing, fast. So I agree that something needs to be done, but I suspect that doing it well will require considerable thought and work.

  3. tacaswell commented on May 13, 2014

    @tacaswell
    Member

    Punting to 1.4.x

  4. modified the milestones: v1.4.x, v1.4.0 on May 13, 2014
  5. pelson commented on May 20, 2014

    @pelson
    Member

    Punting to 1.4.x

    Did you mean that, or was that meant to be 1.5?

  6. tacaswell commented on May 20, 2014

    @tacaswell
    Member

    yup, should have been 1.5 (didn't read my own earlier comments).

  7. modified the milestones: , v1.4.x on May 20, 2014
  8. petehuang commented on Dec 29, 2016

    @petehuang
    Contributor

    Hi,

    This issue has been inactive for a while. What is the latest discussion / development for this topic? Thanks!

  9. modified the milestones: , on Oct 3, 2017
  10. modified the milestones: needs sorting, v3.4.0 on Feb 16, 2021
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

    API: consistencyConsistency of the matplotlib API, including naming, behavior, defaults, …status: needs patch

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions