You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
style.use('classic') differs from defaults in 1.5 #6696
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:
Gray background and larger with classic style:
Trying to reproduce the defaults with rc settings:
However, the vertical layouts in [1] and [3] still differ a little bit (can they be made byte-identical?).
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?).
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.
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.
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).
Activity
tacaswell commentedon Jul 6, 2016
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 commentedon Jul 6, 2016
Thanks: Maybe there is a way to load those defaults in
1.5and2?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 commentedon Jul 6, 2016
Indeed the y-ticks are not exactly spaced the same in the two png files:

WeatherGod commentedon Jul 6, 2016
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:
tacaswell commentedon Jul 6, 2016
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 commentedon 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
ipykernelmakemplstylefiles available for use bymatplotlib?Carreau commentedon 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 commentedon Jul 6, 2016
A workaround to preserve styling is to simply do
%matplotlib inlineafterplt.style.use('classic').timhoffm commentedon May 26, 2019
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).