Matplotlib plotting style 'classic' hardcoded to Sage

64 views
Skip to first unread message

Kwankyu Lee

unread,
Jul 8, 2018, 9:36:57 PM7/8/18
to sage-devel
Hi,

This ticket

https://trac.sagemath.org/ticket/25799

aims to remove matplotlib style 'classic' hardcoded into Sage. This makes customization through the matplotlibrc file work, which fails presently.

After the ticket merged, the default matplotlib styles would be applied to all Sage graphics, and Sage graphics may look subtly different than what you have been used to. If you don't like this, then raise your voice to the ticket. 

François Bissey

unread,
Jul 8, 2018, 9:40:03 PM7/8/18
to sage-...@googlegroups.com
I am sorry to have introduced that in the upgrade to matplotlib 2.1. Hardcoding
was easier than setting the style to classic for every calls for the documentation.
The reports I had was that the default style from 2.1 onwards made the documentation
plots look ugly.

François
> --
> You received this message because you are subscribed to the Google Groups "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+...@googlegroups.com.
> To post to this group, send email to sage-...@googlegroups.com.
> Visit this group at https://groups.google.com/group/sage-devel.
> For more options, visit https://groups.google.com/d/optout.

Kwankyu Lee

unread,
Jul 9, 2018, 4:24:26 AM7/9/18
to sage-devel


On Monday, July 9, 2018 at 10:40:03 AM UTC+9, François Bissey wrote:
I am sorry to have introduced that in the upgrade to matplotlib 2.1. Hardcoding
was easier than setting the style to classic for every calls for the documentation.
The reports I had was that the default style from 2.1 onwards made the documentation
plots look ugly. 

I looked through the documentation rebuilt with the current default style. It still looks great, and I find nothing ugly :-)

Kwankyu Lee

unread,
Jul 9, 2018, 4:34:55 AM7/9/18
to sage-devel
Yeah, I found one thing that looks ugly on my machine:

In the 'classic' style:

In the current default style:










Auto Generated Inline Image 1
Auto Generated Inline Image 2

François Bissey

unread,
Jul 9, 2018, 4:38:18 AM7/9/18
to sage-...@googlegroups.com
Generally equations look better with the font choices in the “classic” style which was
the default before matplotlib-2.


> On 9/07/2018, at 20:34, Kwankyu Lee <ekwa...@gmail.com> wrote:
>
> Yeah, I found one thing that looks ugly on my machine:
>
> In the 'classic' style:
>
> <Auto Generated Inline Image 1.png>
> In the current default style:
>
>
>
>
>
>
>
>
> <Auto Generated Inline Image 2.png>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+...@googlegroups.com.
> To post to this group, send email to sage-...@googlegroups.com.
> Visit this group at https://groups.google.com/group/sage-devel.
> For more options, visit https://groups.google.com/d/optout.
> <Auto Generated Inline Image 1.png><Auto Generated Inline Image 2.png>

Kwankyu Lee

unread,
Jul 9, 2018, 6:53:24 AM7/9/18
to sage-devel
Consulting 


we may keep specifically only the math font of the classic style by:

mpl.rcParams['mathtext.fontset'] = 'cm'
mpl.rcParams['mathtext.rm'] = 'serif'

and adopt the default matplotlib-2 style generally. I assume that the matplotlib-2 style is an improvement over the classic style in general.

Eric Gourgoulhon

unread,
Jul 10, 2018, 3:25:10 AM7/10/18
to sage-devel
HI,


Le lundi 9 juillet 2018 12:53:24 UTC+2, Kwankyu Lee a écrit :
Consulting 


we may keep specifically only the math font of the classic style by:

mpl.rcParams['mathtext.fontset'] = 'cm'
mpl.rcParams['mathtext.rm'] = 'serif'

and adopt the default matplotlib-2 style generally.

Indeed this would be a good solution. Without it, the math output is really ugly, as shown in this example.
IIRC, this was the main reason to set the default style to 'classic' while upgrading to Matplotlib 2.1.
Let me stress that when using Jupyter notebooks with %display latex, it is nice to have exactly the same fonts in legend labels of plots as in MathJax outputs.

Best wishes,

Eric.

Reply all
Reply to author
Forward
0 new messages