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

Skip to content

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

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
xflr6 opened this issue Jul 6, 2016 · 9 comments
Closed

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

xflr6 opened this issue Jul 6, 2016 · 9 comments

Comments

@xflr6
Copy link

xflr6 commented Jul 6, 2016

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?).

@tacaswell
Copy link
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

@xflr6
Copy link
Author

xflr6 commented Jul 6, 2016

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?).

@afvincent
Copy link
Contributor

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

@WeatherGod
Copy link
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 [email protected]
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
.

@tacaswell
Copy link
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.

@xflr6
Copy link
Author

xflr6 commented Jul 6, 2016

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?

@Carreau
Copy link
Contributor

Carreau commented Jul 6, 2016

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.

@xflr6
Copy link
Author

xflr6 commented Jul 6, 2016

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

@timhoffm
Copy link
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
Projects
None yet
Development

No branches or pull requests

6 participants