From: John H. <jdh...@ac...> - 2004-03-18 23:28:20
|
>>>>> "Dominique" == Dominique Orban <Dom...@po...> writes: Dominique> Regarding my previous message on TeX labels, it would Dominique> seem that having parentheses in there mix up the Dominique> alignment. Not "regular" text, as i previously Dominique> suggested. This makes more sense. All the symbols that come from cmex10 (a TeX computer modern font) have some funny alignment that I have not been able to figure out properly and so I deal with them in some hackish ways that you have just experienced. Thanks for the report, because it lets me know where the hacks are failing. But your post gave me a better idea. Since parentheses are so common, and are defined in a number of the font files, I can use the parentheses from a font file that doesn't have this strange offset problem. Edit matplotlib.mathtext.py and comment out the following code and replace it with the code below it #'(' : ('cmex10.ttf', 'A1'), #r'\leftparen' : ('cmex10.ttf', 'A1'), #')' : ('cmex10.ttf', 'A2'), #r'\rightparen' : ('cmex10.ttf', 'A2'), #'[' : ('cmex10.ttf', 'A3'), #r'\leftbracket' : ('cmex10.ttf', 'A3'), #']' : ('cmex10.ttf', 'A4'), #r'\rightbracket' : ('cmex10.ttf', 'A4'), '(' : ('cmr10.ttf', '28'), r'\leftparen' : ('cmr10.ttf', '28'), ')' : ('cmr10.ttf', '29'), r'\rightparen' : ('cmr10.ttf', '29'), '[' : ('cmr10.ttf', '5B'), r'\leftbracket' : ('cmr10.ttf', '5B'), ']' : ('cmr10.ttf', '5D'), r'\rightbracket' : ('cmr10.ttf', '5D'), This takes the symbols (, ), [ and ] from computer modern roman rather than computer modern extensions and the alignment works perfectly. Note also that vertical alignment of mathtext (ylabels) is not yet supported. Feel free to bug me if this is an issue. I expect plenty more issues to crop up with mathtext since it is not widely tested and I am not Knuth so please let me know when you find them. The author of pyparsing has been helping me with the parsing problem that prevents x_i_j from parsing properly but I haven't been able to get to it yet. Dominique> A final comment, using gca().set_yticks( ... ) prints a Dominique> large number of messages "<matplotlib.axis.YTick Dominique> instance at ...>". There must be a print somethere. You're in interactive mode right? In a python shell >>> 2+2 4 >>> x = 2+2 >>> Ie, an expression which is not assigned to a name is printed in the shell in interactive mode. set_ticks returns a list of tick labels to allow you to do things like labels = gca().set_yticks(['a', 'b', 'c']) set(labels, 'color', 'r') The point is, if you assign the return value of set_ticks a name, it should no longer print to the shell. Ditto for other plot functions that return a value. If this doesn't cure you, let me know. A residual print is always a possibility. JDH |