First time here? Check out the FAQ!

Ask Your Question
1

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

asked 11 years ago

spok gravatar image

updated 11 years ago

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?

Preview: (hide)

2 Answers

Sort by » oldest newest most voted
2

answered 11 years ago

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']})
Preview: (hide)
link

Comments

Thanks! I could find something that helped me.

spok gravatar imagespok ( 11 years ago )
2

answered 11 years ago

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.
Preview: (hide)
link

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: 11 years ago

Seen: 2,149 times

Last updated: Jun 09 '13