Ask Your Question
1

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:

\begin{sagesilent}
  p2 = list_plot(zip(H, f(5)), True, color='blue', axes_labels=[u'$H,$ ??',u'$\mu, c$'])
  p2.fontsize(14)
\end{sagesilent}

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

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

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
2

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 http://trac.sagemath.org/14664 you might want to try plot(..., typeset='latex').

Apart from that, you can change matplotlib defaults:

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

Comments

Thanks! I could find something that helped me.

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

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['font.family'] = '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

Stats

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

Seen: 883 times

Last updated: Jun 09 '13