Ask Your Question

Sage + Latex - How to change a font for axes label?

asked 2013-06-09 00:09:43 -0500

spok gravatar image

updated 2013-06-09 00:19:15 -0500

I use Sage and LaTeX and when I do this:

  p2 = list_plot(zip(H, f(5)), True, color='blue', axes_labels=[u'$H,$ ??',u'$\mu, c$'])

and run sage DIPLOM.sagetex.sage I get this:

/usr/lib/sagemath/local/lib/python2.7/site-packages/matplotlib/ MathTextWarning: Font 'default' does not have a glyph for '\u043a' [U43a]

So how can I change a font name to use not only latin symbols?

PS: Even here these symbols are displayed as "??". Can't this site handle unicode?

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2013-06-09 02:33:09 -0500

Volker Braun gravatar image

If you want help you should always paste a working example. Here are some untested (untestable) tips:

With you might want to try plot(..., typeset='latex').

Apart from that, you can change matplotlib defaults:

from matplotlib import rc, rcParams
rc('font',**{'family':'serif','serif':['Computer Modern']})
edit flag offensive delete link more


Thanks! I could find something that helped me.

spok gravatar imagespok ( 2013-06-09 11:53:47 -0500 )edit

answered 2013-06-09 11:55:13 -0500

spok gravatar image

One can change font family and sizes in a following way:

### rcParams are the default parameters for matplotlib
import matplotlib as mpl
mpl.rcParams['font.size'] = 10.
mpl.rcParams[''] = 'Comic Sans MS'
mpl.rcParams['axes.labelsize'] = 8.
mpl.rcParams['xtick.labelsize'] = 6.
mpl.rcParams['ytick.labelsize'] = 6.
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2013-06-09 00:09:43 -0500

Seen: 873 times

Last updated: Jun 09 '13