Skip to content

style.use('classic') differs from defaults in 1.5 #6696

Closed

Description

@xflr6

I would like to use the classic style to make plots look the same across 1.5 and 2 and expected that plt.style.use('classic') would basically be a non-op on 1.5 (no visual differences), which does not seem to be the case (but is intended?).

Jupyter notebook with 1.5.2:
snap1

Gray background and larger with classic style:
snap2

Trying to reproduce the defaults with rc settings:
snap3

However, the vertical layouts in [1] and [3] still differ a little bit (can they be made byte-identical?).

Activity

  1. tacaswell commented on Jul 6, 2016

    @tacaswell
    Member

    The background issue is that the inline backend (which is maintained by IPython/Jupyter) has different defaults than upstream.

    Not sure what you mean by 'vertical layout'

    attn @Carreau

  2. xflr6 commented on Jul 6, 2016

    @xflr6
    Author

    Thanks: Maybe there is a way to load those defaults in 1.5 and 2?

    The vertical differences: When I compare the two saved png-files, (some of) the distances between the ticks on the y-axis in [1] and [3] are slightly different. Though the image size is the same, the plot box in [3] is a little taller (maybe different rounding methods?).

  3. afvincent commented on Jul 6, 2016

    @afvincent
    Contributor

    Indeed the y-ticks are not exactly spaced the same in the two png files:
    vertical_layout_issue

  4. WeatherGod commented on Jul 6, 2016

    @WeatherGod
    Member

    This is likely because the ipython backends applies bbox_inches='tight' by
    default and does tight_layout, too, IIRC. Most likely, applying the classic
    style might be turning those things off. You won't notice any difference
    outside of ipython, though. The 'classic' style is utilized throughout our
    test suite so that we wouldn't have to update our test images en mass for
    the 2.0 changes. So we know 'classic' style works.

    On Wed, Jul 6, 2016 at 9:17 AM, Adrien F. Vincent notifications@github.com
    wrote:

    Indeed the y-ticks are not exactly spaced the same in the two png files:
    [image: vertical_layout_issue]
    https://cloud.githubusercontent.com/assets/17270724/16619005/8114742a-438c-11e6-8c9a-f7c0cc3d6a59.png

    —
    You are receiving this because you are subscribed to this thread.
    Reply to this email directly, view it on GitHub
    #6696 (comment),
    or mute the thread
    https://github.com/notifications/unsubscribe/AARy-HnMxORf_Mi4SEPB3A_tzoswxW0Sks5qS6rrgaJpZM4JF733
    .

  5. tacaswell commented on Jul 6, 2016

    @tacaswell
    Member

    We should probably exclude the figure face color from the classic style (as it does not get saved and should only be affecting the GUIs).

    If you want a 'classic-inline' style sheet, I think that should come from the jupyter team.

  6. xflr6 commented on Jul 6, 2016

    @xflr6
    Author

    Thanks for the hints, I found the wanted settings here: with another plt.rc('figure.subplot', bottom=.125) the plots are identical.

    Yes, a 'classic-inline' style sheet with the said settings would be great: Can ipykernel make mplstyle files available for use by matplotlib?

  7. Carreau commented on Jul 6, 2016

    @Carreau
    Contributor

    This overwriting of default is really annoying, and we should definitively find a better way to have our inline backend. Add to the list of things to discuss again at SciPy.

    Opened an IPython issue to track that.

  8. xflr6 commented on Jul 6, 2016

    @xflr6
    Author

    A workaround to preserve styling is to simply do %matplotlib inline after plt.style.use('classic').

  9. timhoffm commented on May 26, 2019

    @timhoffm
    Member

    I'm closing this because I don't think we want to invest any time in a better classic compatibility.

    Apart from that, the new 'classic' style has been around for so long that it's a de-facto standard of its own. Changing that now would also break some user code (I could even imagine that nowadays more people use the 'classic' style than the original matplotlib 1.5).

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

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions