From: Darren D. <dd...@co...> - 2007-07-24 15:42:49
|
On Tuesday 24 July 2007 9:50:46 am Peter W=FCrtz wrote: > Hi, > > I ran into some troubles when trying to do the following with > matplotlib: > - plotting a figure > - using latex for axis labels > - (getting acceptable fonts) > - getting a pdf in the end > I've not been able to solve this. > > In the documentation I found 2 ways to do this. First, when a string is > enclosed in $ signs, matplotlib has its own way of rendering latex code. > Thats ok for mathematical expressions, but I can't print normal text at > all. The documentation says that \rm{} should be used, but > > "$\rm{some label text} (\mu V)$" becomes "somelabeltext\muV" I think you need to use raw strings so your \'s are interpretted as \'s and= =20 not as special characters (like \n is newline). We know it is inconvenient= =20 that you cant do something like r'This example: $a=3De^{i\pi}$' with the=20 existing mathtext, but it is a difficult problem and remains unsolved. > so I searched again and found another documentation, telling me to > enable 'text.usetex' so all text is handled by latex. This way, the text > is rendered correctly, but then the font used for the tick numbers > switches to some ugly looking font. =46or starters, see http://www.scipy.org/Cookbook/Matplotlib/UsingTex. I su= ggest=20 changing your serif rc settings to use the PSNFSS fonts described in that=20 link. Also, try deleting your ~/.matplotlib/tex.cache. > Because Latex mode does not seem to work with the pdf output,=20 It doesn't, not yet. > I saved=20 > these figures as EPS, using epstopdf in oder to get a pdf. Normally this > process gives me perfect results, but the ugly-font-ticks problem is > getting even worse, because in the pdf some of them are just missing. Try getting your system set up to use the xpdf distiller, that has always=20 given me excellent results. > I upped the eps and pdf files here: > http://www.staff.uni-mainz.de/wuertz/matplotlib/ > There is also a png file with a screenshot from the "ugly" and missing > ticks. > > Plotting a reasonable figure seems to be hard, is there any chance of > solving this problem? There have been many problems reported on this mailing list that concern la= tex=20 markup. Most often, people have difficulty getting usetex to work because=20 matplotlib depends on latex, dvipng, ghostscript, and optionally xpdf (more= =20 precisely, xpdf's pdftops utility). If those dependencies are not working=20 properly, or if you are missing latex packages or fonts, then it shows up i= n=20 mpl's output. Darren |