From: David P. S. <dps...@ci...> - 2013-07-20 15:00:14
|
Example script for using mathtext.fontset: import matplotlib as mpl import numpy as np from matplotlib import pyplot as plt mpl.rcParams["mathtext.fontset"] = "stix" x = np.arange(-5, 5, 0.01) y = x*x plt.plot(x, y) plt.xlabel(r"$x$") plt.ylabel(r"$x^2$") plt.show() Apparently the axis labels are correctly rendered using STIX fonts, *but* in a bitmapped way (?). At least, on my retina screen the labels look fuzzy. How can I change also the tic labels to use STIX fonts? By the way, the following is a useful idiom to search for relevant parameters in the rcParams: [k for k in mpl.rcParams.keys() if 'font' in k] I think it would be useful to document this -- where would be a good place? Finally, could somebody please explain what 'rc' means? This does not seem like a good name to me. I know it comes from the UNIX world, but I couldn't find an explanation for 'rc' on Wikipedia. OK, I found it: http://www.catb.org/jargon/html/R/rc-file.html This is not good -- there is *no* reason to use the nomenclature 'rc'; this is just confusing for users who find it arcane and unwelcoming (I speak from experience). Could it not just be called mpl.parameters, or mpl.mpl_parameters, or something like that? Best, David On Sat, Jul 20, 2013 at 9:41 AM, David P. Sanders < dps...@ci...> wrote: > I find the default font used in matplotlib horrible. We should be able to > do much better these days. > > One very interesting option, at least for standard (paper) publishing, is > the STIX fonts, which is a Times-like font set promoted by several > publishers. > > There are various options in matplotlib, such as > matplotlib.rcParams["mathtext.fontset"], which allow the option "stix", > but I have not been able to get it to work. Can anybody please help me with > this -- what is required? > > I have the STIX otf or ttf installed on my Mac, but I don't seem to manage > to get the LaTeX versions installed -- installing LaTeX fonts is *so* > disgusting (is there some helper script for that?). > > Thanks and best wishes, > David. > > -- > Dr. David P. Sanders > > Profesor Titular "A" / Associate Professor > Departamento de Física, Facultad de Ciencias > Universidad Nacional Autónoma de México (UNAM) > > dps...@ci... > http://sistemas.fciencias.unam.mx/~dsanders > > Cubículo / office: #414, 4o. piso del Depto. de Física > > Tel.: +52 55 5622 4965 > -- Dr. David P. Sanders Profesor Titular "A" / Associate Professor Departamento de Física, Facultad de Ciencias Universidad Nacional Autónoma de México (UNAM) dps...@ci... http://sistemas.fciencias.unam.mx/~dsanders Cubículo / office: #414, 4o. piso del Depto. de Física Tel.: +52 55 5622 4965 |