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

Plot title should be shifted up when xticks are set to the top of the plot · Issue #1415 · matplotlib/matplotlib · GitHub

Repository navigation

Plot title should be shifted up when xticks are set to the top of the plot #1415

Closed

Description

This is an issue that came up in http://trac.sagemath.org/13625

When subplot.xaxis.tick_top() is used, then the position of the plot title is not recomputed. Ideally, it should be shifted further up. Example code is as follows

from matplotlib.figure import Figure
figure = Figure()
subplot = figure.add_subplot(111)
subplot.plot(range(10),range(10))
subplot.xaxis.tick_top()
subplot.set_title('a title')
from matplotlib.backends.backend_agg import FigureCanvasAgg
figure.set_canvas(FigureCanvasAgg(figure))
figure.savefig('/tmp/a.png')

Activity

  1. pelson commented on Oct 19, 2012

    Member

    Definitely another one for the #1109 folio.

    The traditional fix which seems to have been used in axes.spy and axes.matshow is to set the y position of the title to axes.get_title.set_y(1.05), but there are obvious pitfalls with this approach...

  2. kcrisman commented on Oct 19, 2012

    Contributor

    Looking at #1109, does that mean this is not going to be fixed soon, or does it mean this is fixable now but #1109 would provide a more elegant overall solution? We may try a workaround on the Sage end, but if there is a patch we could apply to mpl, that would be even better.

  3. ppurka commented on Oct 19, 2012

    Author

    I see the mention of QML in #1109. The ideas in QML seem quite similar to the ones in edje, which is one of the libraries behind enlightenment and has been around for nearly a decade ( see http://www.enlightenment.org and http://docs.enlightenment.org/auto/edje/ ). So, it might be useful for you to look at that project since all the theming and layout in enlightenment happens through edje.

  4. pelson commented on Oct 19, 2012

    Member

    but there are obvious pitfalls with this approach...

    I have just trawled the axes.py module and looking at it, anything which extends beyond the plotting area is done in this way (axes coordinates outside of the range 0 <= x <=1), so while this approach obviously has pitfalls, it is also consistent with how the title and tickmarks are already being done...

  5. pelson commented on Oct 19, 2012

    Member

    Looking at #1109, does that mean this is not going to be fixed soon

    No, it is not even clear how what is going to be implemented at this point, we are still very much at the brainstorming stage.

    @ppurka : please feel free to put your suggestions in the geom manager issue - what you are saying sounds very sensible indeed.

    Cheers,

  6. added 4 commits that reference this issue on Mar 25, 2014
  7. petehuang commented on Dec 31, 2016

    Contributor

    I reproduced with 1.5.3:

    Recommend labeling as geometry manager to mirror #1109, which is still the source of truth for this work

  8. efiring commented on Jan 3, 2017

    Member

    I think that if there is going to be a partial fix for this any time soon, it will be via using the same logic for the titles as we are using for the xlabel and ylabel. They are already taking into account the ticks and tick labels. An additional wrinkle might be the case of twinned axes; the title-positioning logic for either axes would have to check for ticks and tick labels on both axes.

  9. modified the milestones: , on Oct 3, 2017
  10. modified the milestones: , on Mar 8, 2018
  11. jklymak commented on Mar 8, 2018

    Member

    This is fixed by #9498. Removing geometry manager label, as its not necessary for this...

  12. afvincent commented on Apr 3, 2018

    Contributor

    Closed by #9498 (commit 7b30275).

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL