Screenshot instructions:
Windows
Mac
Red Hat Linux
Ubuntu
Click URL instructions:
Rightclick on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)
From: Sebastian Busch <webmaster@th...>  20090510 17:16:59
Attachments:
signature.asc

Hello everybody! I am experiencing the following problem: when I draw text with usetex enabled and the xcolor package, the result is not colored; however the intermediate steps that I find in .../tex.cache still are! The problem occurs with: ===== from matplotlib import rc from pylab import figure, text, show, savefig rc('text', usetex=True) rc('text.latex', preamble="\usepackage{xcolor}") f = figure() f.text(0.5,0.5,r"{\color[rgb]{0,1,0}a}b") show() #savefig("colortest.png") ===== The resulting graph is not colored  but in the directory ~/.matplotlib/tex.cache/ the text is green, both in the dvi and the png file! It therefore seems to me that this is not completely hopeless but I cannot figure out how to proceed. Can someone help? Thanks & best regards, Sebastian. I am on Linux macbook 2.6.2711generic #1 SMP Wed Apr 1 20:53:41 UTC 2009 x86_64 GNU/Linux running Python 2.5.2 (r252:60911, Oct 5 2008, 19:29:17) and matplotlib 0.98.3 downloaded from the Ubuntu repositories for 8.10. I ran > python colortest.py verbosehelpful /usr/lib/python2.5/sitepackages/pytz/__init__.py:29: UserWarning: Module dateutil was already imported from /var/lib/pythonsupport/python2.5/dateutil/__init__.py, but /var/lib/pythonsupport/python2.5 is being added to sys.path from pkg_resources import resource_stream $HOME=/... CONFIGDIR=/.../.matplotlib matplotlib data path /usr/share/matplotlib/mpldata loaded rc file /etc/matplotlibrc matplotlib version 0.98.3 verbose.level helpful interactive is False units is False platform is linux2 Using fontManager instance from /home/buschi/.matplotlib/fontManager.cache backend TkAgg version 8.4 Found dvipng version 1.11 and > python colortest.py verbosedebug /usr/lib/python2.5/sitepackages/pytz/__init__.py:29: UserWarning: Module dateutil was already imported from /var/lib/pythonsupport/python2.5/dateutil/__init__.py, but /var/lib/pythonsupport/python2.5 is being added to sys.path from pkg_resources import resource_stream $HOME=/... CONFIGDIR=/.../.matplotlib matplotlib data path /usr/share/matplotlib/mpldata loaded rc file /etc/matplotlibrc matplotlib version 0.98.3 verbose.level debug interactive is False units is False platform is linux2 loaded modules: ['numpy.lib.pkgutil', 'numpy.lib.tempfile', 'numpy.ma.types', 'xml.sax.urlparse', 'distutils', 'matplotlib.errno', 'matplotlib.matplotlib', '_bisect', 'numpy.core.defchararray', 'numpy.lib.bz2', 'matplotlib.tempfile', 'distutils.sysconfig', 'ctypes._endian', 'encodings.encodings', 'matplotlib.dateutil', 'matplotlib.colors', 'numpy.core.numerictypes', 'numpy.testing.sys', 'numpy.core.info', 'xml', 'numpy.fft.types', 'numpy.ma.operator', 'distutils.dep_util', 'numpy.ma.cPickle', 'struct', 'numpy.random.info', 'tempfile', 'mmap', 'xml.sax.urllib', 'numpy.linalg', 'matplotlib.threading', 'numpy.testing.operator', 'imp', 'compiler.sys', 'collections', 'compiler.pyassem', 'numpy.core.umath', '_struct', 'unittest', 'compiler.new', 'numpy.lib.numpy', 'numpy.testing.types', 'compiler.ast', 'numpy.ma.sys', 'zipimport', 'string', 'numpy.testing.os', 'matplotlib.locale', 'numpy.lib.arraysetops', 'numpy.testing.unittest', 'numpy.lib.inspect', 'encodings.utf_8', 'matplotlib.__future__', 'pytz.tzinfo', 'numpy.ctypeslib', 'numpy.testing.re', 'itertools', 'numpy.version', 'numpy.lib.re', 'distutils.re', 'ctypes.os', 'compiler.token', 'numpy.core.os', 'compiler', 'numpy.lib.type_check', 'httplib', 'bisect', 'signal', 'compiler.consts', 'numpy.lib._datasource', 'random', 'numpy.ma.extras', 'token', 'numpy.fft.fftpack_lite', 'shlex', 'ctypes.ctypes', 'xml.sax.xmlreader', 'matplotlib.pytz', 'numpy.__builtin__', 'numpy.testing.shlex', 'distutils.log', 'dis', 'numpy.lib.itertools', 'cStringIO', 'zlib', 'numpy.numpy', 'matplotlib.StringIO', 'numpy.random.mtrand', 'numpy.add_newdocs', 'numpy.lib.getlimits', 'compiler.dis', 'compiler.transformer', 'xml.sax.saxutils', 'compiler.struct', 'pkgutil', 'compiler.parser', 'numpy.lib.sys', 'encodings', 'compiler.symbol', 'numpy.lib.io', 'StringIO', 'dateutil', 'pydoc', 'pytz.cStringIO', 'numpy.imp', 'numpy.ctypes', 'matplotlib.warnings', 'rfc822', 'matplotlib.string', 'pytz.pytz', 'urllib', 'matplotlib.sys', 're', 'numpy.lib._compiled_base', 'threading', 'numpy.core.mmap', 'new', 'numpy.lib.struct', 'symbol', 'math', 'numpy.fft.helper', 'fcntl', 'numpy.ma.warnings', 'compiler.imp', 'UserDict', 'inspect', 'distutils.os', 'matplotlib', 'urllib2', 'pytz.os', 'fnmatch', 'numpy.lib.info', 'numpy.testing', 'numpy.testing.glob', 'numpy.lib.warnings', 'ctypes.struct', 'codecs', 'numpy.core._sort', 'numpy.os', 'pytz.bisect', 'compiler.visitor', 'md5', 'numpy.testing.difflib', 'matplotlib.sre_constants', 'matplotlib.os', 'thread', 'numpy.lib.ufunclike', 'numpy.core.memmap', 'traceback', 'pkg_resources', 'numpy.testing.warnings', 'weakref', 'numpy.core._internal', 'numpy.fft.fftpack', 'opcode', 'numpy.core.scalarmath', 'numpy.linalg.lapack_lite', 'ctypes', 'distutils.sys', 'os', 'marshal', 'sre_parse', 'numpy.lib.shutil', '__future__', 'numpy.core.string', 'matplotlib.copy', 'xml.sax.types', 'numpy.random.numpy', '_sre', 'numpy.lib.gzip', 'numpy.core.sys', 'numpy.random', 'numpy.linalg.numpy', '__builtin__', 'numpy.lib.twodim_base', 'numpy.ma.core', 'matplotlib.re', 'numpy.core.cPickle', 'base64', 'operator', 'numpy.testing.parametric', 'numpy.core.arrayprint', 'distutils.string', 'ctypes._ctypes', '_heapq', 'ctypes.sys', 'matplotlib.datetime', 'posixpath', 'numpy.lib.financial', 'numpy.core.multiarray', 'errno', 'numpy.testing.numpy', '_socket', 'binascii', 'numpy.lib.compiler', 'sre_constants', 'compiler.cStringIO', 'locale', 'compiler.os', 'matplotlib.md5', 'types', 'pytz.sys', 'tokenize', 'xml.sax.handler', 'numpy.core.numpy', 'numpy', 'numpy.lib.urlparse', 'pytz.pkg_resources', 'matplotlib.types', 'numpy.core.defmatrix', 'xml.sax.os', 'cPickle', 'matplotlib.xml', '_codecs', '_locale', 'matplotlib.traceback', 'numpy.__config__', 'numpy.fft.info', 'numpy.lib.types', 'pytz', 'matplotlib.pyparsing', 'compiler.copy_reg', 'numpy.ma.numpy', 'copy', 'numpy.core.re', 'socket', '_types', 'numpy.core.fromnumeric', 'hashlib', 'compiler.future', 'matplotlib.cbook', 'numpy.core.copy_reg', 'numpy.lib.scimath', 'numpy.fft', 'numpy.lib', '_ctypes', 'apport_python_hook', 'posix', 'encodings.aliases', 'matplotlib.fontconfig_pattern', 'exceptions', 'xml.sax._exceptions', 'datetime', 'sets', 'numpy.core.cStringIO', 'numpy.core.ctypes', 'mimetools', 'distutils.distutils', 'copy_reg', 'sre_compile', 'xml.sax', 'compiler.compiler', '_hashlib', '_random', 'parser', 'site', 'numpy.lib.polynomial', 'numpy._import_tools', 'numpy.glob', 'pytz.struct', 'numpy.lib.time', '__main__', 'compiler.misc', 'numpy.core.records', 'shutil', 'numpy.lib.cPickle', 'numpy.sys', 'matplotlib.weakref', 'numpy.lib.pydoc', 'numpy.core._dotblas', 'numpy.testing.traceback', 'strop', 'compiler.pycodegen', 'numpy.core.numeric', 'pytz.tzfile', 'numpy.linalg.info', 'encodings.codecs', 'gettext', 'pytz.datetime', 'heapq', 'numpy.lib.cStringIO', 'numpy.core', 'numpy.testing.info', 'matplotlib.rcsetup', 'matplotlib.time', 'pytz.sets', 'matplotlib.numpy', 'xml.sax.codecs', 'stat', '_ssl', 'numpy.lib.utils', 'numpy.lib.index_tricks', 'numpy.testing.utils', 'warnings', 'encodings.types', 'numpy.lib.math', 'glob', 'numpy.lib.shape_base', 'distutils.util', 'numpy.core.types', 'numpy.fft.numpy', 'repr', 'sys', 'numpy.core.warnings', 'numpy.lib.urllib2', 'compiler.types', 'numpy.core.__builtin__', 'xml.sax.sys', 'numpy.lib.format', 'numpy.lib.os', 'numpy.ma', 'os.path', 'bz2', 'pytz.gettext', 'sitecustomize', 'compiler.symbols', 'distutils.spawn', 'matplotlib.distutils', '_weakref', 'numpy.testing.numpytest', 'difflib', 'distutils.errors', 'urlparse', 'linecache', 'matplotlib.shutil', 'numpy.lib.function_base', 'numpy.testing.imp', 'time', 'gzip', 'numpy.lib.machar', 'compiler.marshal', 'numpy.linalg.linalg', 'compiler.syntax'] Using fontManager instance from /home/buschi/.matplotlib/fontManager.cache backend TkAgg version 8.4 findfont found Bitstream Vera Sans, normal, normal 400, normal, 12.0 findfont returning /usr/share/fonts/truetype/ttfbitstreamvera/Vera.ttf Found dvipng version 1.11 
From: JaeJoon Lee <lee.j.joon@gm...>  20090511 18:37:04

> > The resulting graph is not colored  but in the directory > ~/.matplotlib/tex.cache/ the text is green, both in the dvi and the png > file! > > It therefore seems to me that this is not completely hopeless but I > cannot figure out how to proceed. > As far as I know, in matplotlib, all the tex png output is treated as grey internally (the only exception I know of is ps backend, e.g., your example will show you a correct color if you save it as ps). I guess this may have been a design decision. As far as I can see, MPL currently does not support texts with varying font properties (size, color, font). One possible workaround for this could be using the latex typesetting as you tried. However, supporting this within the current text framework of matplotlib would be difficult and may not be a good idea. However, I guess there are a few workarounds you may consider to use (but unfortunately I think none of them are easy to work with). So, if you describe where you intend to use multicolor text, I'll try to give some example appropriate for your situation. Multicolor text in figure title or simple annotation would be relatively simple. Multicolor text in legend label seems to be more difficult, but should be doable. JJ 
From: Sebastian Busch <webmaster@th...>  20090512 09:47:53
Attachments:
signature.asc

Hey JaeJoon! Thank you for your answer! JaeJoon Lee wrote: > ...your example will show you a correct color if you save it as ps... Indeed the ps output is colored! That's great :) > ... describe where you intend to use multicolor text ... OK, you got me  actually, this was already a hack. My problem is that I have labels which read something like d = 12m where the number varies within ]0, 20[. I would have liked to get an aligned legend, like d = 9m d = 10m In order to achieve that, i was trying to print a white (=invisible) "1" whenever the number was smaller than 10 as spaceholder (I do not want to use a monospaced font). Obviously, this doesn't work any more as soon as you reach 20... Thanks again for the help  I'm happy for the moment, but if you (or someone else) can show me how to align the legend, it would be great. Best wishes, Sebastian. 
From: Matthias Michler <MatthiasMichler@gm...>  20090512 09:04:15
Attachments:
test_tex_color.eps
test_tex_color.ps

Hello list, I'm not sure that following problem also occurs for Sebastian, but if I use PSbackend in the below script I get the attached output, where the upper part of the b is somehow hidden (matplotlibversion 0.98.6svn). Is this a problem of matplotlib or did I miss something in the texhandling? best regards Matthias >  from matplotlib import use, rc use('PS') from pylab import figure, savefig rc('text', usetex=True) rc('text.latex', preamble="\usepackage{color}") f = figure() f.text(0.5, 0.5, r"{\color[rgb]{0,1,0} a } b {\color{blue} $\nu, \mu, \tau$}") savefig('test_tex_color.ps') >  On Monday 11 May 2009 20:36:58 JaeJoon Lee wrote: > > The resulting graph is not colored  but in the directory > > ~/.matplotlib/tex.cache/ the text is green, both in the dvi and the png > > file! > > > > It therefore seems to me that this is not completely hopeless but I > > cannot figure out how to proceed. > > As far as I know, in matplotlib, all the tex png output is treated as > grey internally (the only exception I know of is ps backend, e.g., > your example will show you a correct color if you save it as ps). I > guess this may have been a design decision. > As far as I can see, MPL currently does not support texts with varying > font properties (size, color, font). > One possible workaround for this could be using the latex typesetting > as you tried. However, supporting this within the current text > framework of matplotlib would be difficult and may not be a good idea. > > > However, I guess there are a few workarounds you may consider to use > (but unfortunately I think none of them are easy to work with). So, if > you describe where you intend to use multicolor text, I'll try to > give some example appropriate for your situation. Multicolor text in > figure title or simple annotation would be relatively simple. > Multicolor text in legend label seems to be more difficult, but > should be doable. > > JJ > >  > The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your > production scanning environment may not be a perfect world  but thanks to > Kodak, there's a perfect scanner to get the job done! With the NEW KODAK > i700 Series Scanner you'll get full speed at 300 dpi even with all image > processing features enabled. http://p.sf.net/sfu/kodakcom > _______________________________________________ > Matplotlibusers mailing list > Matplotlibusers@... > https://lists.sourceforge.net/lists/listinfo/matplotlibusers 
From: Sebastian Busch <webmaster@th...>  20090512 09:56:06
Attachments:
signature.asc

Hey Matthias! Thanks for working on that! Matthias Michler wrote: > ... I'm not sure that following problem also occurs for Sebastian, ... it does. > ... PSbackend ... the upper part of the b is somehow hidden ... > f.text(0.5, 0.5, r"{\color[rgb]{0,1,0} a } b {\color{blue} $\nu, \mu, \tau$}") In addition to that, I have the strange behaviour that the "b" is not displayed at all when using f.text(0.5, 0.5, r"{\color[rgb]{0,1,0} a } b") > gives only a green "a" but it is without the "color" command: f.text(0.5, 0.5, r"{ a } b") > gives black "a b" Pretty weird, isn't it? Best, Sebastian. 
From: JaeJoon Lee <lee.j.joon@gm...>  20090512 18:51:33

On Tue, May 12, 2009 at 5:55 AM, Sebastian Busch <webmaster@...> wrote: > f.text(0.5, 0.5, r"{\color[rgb]{0,1,0} a } b") > > gives only a green "a" > Hmm, odd. It gives me both letters in their correct color. Please post your result with the script you used to create it. And, what version of mpl are you using? Also, if possible, please try to install the mpl from the svn and see this problem still exists. JJ 
From: Jouni K. Seppänen <jks@ik...>  20090512 10:52:31

Sebastian Busch <webmaster@...> writes: > I would have liked to get an aligned legend, like > > d = 9m > d = 10m > > In order to achieve that, i was trying to print a white (=invisible) "1" > whenever the number was smaller than 10 as spaceholder (I do not want to > use a monospaced font). Does the \phantom trick work? I.e., r'd = \phantom{1}9m' or something like that? > Obviously, this doesn't work any more as soon as you reach 20... Even if your font is not monospaced, it might have "tabular figures": http://www.fonts.com/aboutfonts/articles/fyti/propvstabfigures.htm I think at least Computer Modern Roman (the default font in TeX) does have tabular figures.  Jouni K. Seppänen http://www.iki.fi/jks 
From: JaeJoon Lee <lee.j.joon@gm...>  20090512 18:30:22

As Jouni suggested, I guess the best chance here is to use phantom command. Here is a little example. rc('text', usetex=True) p1, = plot([1,2,3]) legend([p1, p1, p1, p1], [r"d = $\phantom{0}1$ m", "d = $10$ m", "d = $23$ m", "d = $91$ m"]) JJ On Tue, May 12, 2009 at 6:52 AM, Jouni K. Seppänen <jks@...> wrote: > Sebastian Busch <webmaster@...> writes: > >> I would have liked to get an aligned legend, like >> >> d = 9m >> d = 10m >> >> In order to achieve that, i was trying to print a white (=invisible) "1" >> whenever the number was smaller than 10 as spaceholder (I do not want to >> use a monospaced font). > > Does the \phantom trick work? I.e., r'd = \phantom{1}9m' or something > like that? > >> Obviously, this doesn't work any more as soon as you reach 20... > > Even if your font is not monospaced, it might have "tabular figures": > > http://www.fonts.com/aboutfonts/articles/fyti/propvstabfigures.htm > > I think at least Computer Modern Roman (the default font in TeX) does > have tabular figures. > >  > Jouni K. Seppänen > http://www.iki.fi/jks > > >  > The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your > production scanning environment may not be a perfect world  but thanks to > Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700 > Series Scanner you'll get full speed at 300 dpi even with all image > processing features enabled. http://p.sf.net/sfu/kodakcom > _______________________________________________ > Matplotlibusers mailing list > Matplotlibusers@... > https://lists.sourceforge.net/lists/listinfo/matplotlibusers > 
From: JaeJoon Lee <lee.j.joon@gm...>  20090512 18:46:16

On Tue, May 12, 2009 at 5:04 AM, Matthias Michler <MatthiasMichler@...> wrote: > Hello list, > > I'm not sure that following problem also occurs for Sebastian, but if I use > PSbackend in the below script I get the attached output, where the upper > part of the b is somehow hidden (matplotlibversion 0.98.6svn). > Is this a problem of matplotlib or did I miss something in the texhandling? > Unfortunately, I don't see such problem, although the problem seems to be due to a wrong bounding box. Are you using the most recent svn? There has been some recent changes in ps backend. Before the changes (r7068, r7074), the ps backend tried to adjust the bounding box of the output ps file. However, as far as I can see, this often gave a wrong bounding box (and I guess your problem might be related with this issue). The above mentioned changes somehow bypass that bbox adjustment. The resulting bounding box should have the size of the figure if saved in eps, or size of the paper ("letter" or "a4", I guess) if saved in ps. regards, JJ > best regards Matthias > >>  > from matplotlib import use, rc > use('PS') > from pylab import figure, savefig > > rc('text', usetex=True) > rc('text.latex', preamble="\usepackage{color}") > > f = figure() > f.text(0.5, 0.5, r"{\color[rgb]{0,1,0} a } b {\color{blue} $\nu, \mu, \tau$}") > > savefig('test_tex_color.ps') >>  > > On Monday 11 May 2009 20:36:58 JaeJoon Lee wrote: >> > The resulting graph is not colored  but in the directory >> > ~/.matplotlib/tex.cache/ the text is green, both in the dvi and the png >> > file! >> > >> > It therefore seems to me that this is not completely hopeless but I >> > cannot figure out how to proceed. >> >> As far as I know, in matplotlib, all the tex png output is treated as >> grey internally (the only exception I know of is ps backend, e.g., >> your example will show you a correct color if you save it as ps). I >> guess this may have been a design decision. >> As far as I can see, MPL currently does not support texts with varying >> font properties (size, color, font). >> One possible workaround for this could be using the latex typesetting >> as you tried. However, supporting this within the current text >> framework of matplotlib would be difficult and may not be a good idea. >> >> >> However, I guess there are a few workarounds you may consider to use >> (but unfortunately I think none of them are easy to work with). So, if >> you describe where you intend to use multicolor text, I'll try to >> give some example appropriate for your situation. Multicolor text in >> figure title or simple annotation would be relatively simple. >> Multicolor text in legend label seems to be more difficult, but >> should be doable. >> >> JJ >> >>  >> The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your >> production scanning environment may not be a perfect world  but thanks to >> Kodak, there's a perfect scanner to get the job done! With the NEW KODAK >> i700 Series Scanner you'll get full speed at 300 dpi even with all image >> processing features enabled. http://p.sf.net/sfu/kodakcom >> _______________________________________________ >> Matplotlibusers mailing list >> Matplotlibusers@... >> https://lists.sourceforge.net/lists/listinfo/matplotlibusers > > > >  > The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your > production scanning environment may not be a perfect world  but thanks to > Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700 > Series Scanner you'll get full speed at 300 dpi even with all image > processing features enabled. http://p.sf.net/sfu/kodakcom > _______________________________________________ > Matplotlibusers mailing list > Matplotlibusers@... > https://lists.sourceforge.net/lists/listinfo/matplotlibusers > > 
From: Matthias Michler <MatthiasMichler@gm...>  20090513 07:22:24

Hi JaeJoon, I updated to svnrevision 7099 and the problem (hidden part of b) still exists. Do you have any idea what I'm doing wrong? Thanks in advance for any hints. best regards Matthias On Tuesday 12 May 2009 20:46:06 JaeJoon Lee wrote: > On Tue, May 12, 2009 at 5:04 AM, Matthias Michler > > <MatthiasMichler@...> wrote: > > Hello list, > > > > I'm not sure that following problem also occurs for Sebastian, but if I > > use PSbackend in the below script I get the attached output, where the > > upper part of the b is somehow hidden (matplotlibversion 0.98.6svn). > > Is this a problem of matplotlib or did I miss something in the > > texhandling? > > Unfortunately, I don't see such problem, although the problem seems to > be due to a wrong bounding box. > > Are you using the most recent svn? There has been some recent changes > in ps backend. Before the changes (r7068, r7074), the ps backend tried > to adjust the bounding box of the output ps file. However, as far as I > can see, this often gave a wrong bounding box (and I guess your > problem might be related with this issue). The above mentioned changes > somehow bypass that bbox adjustment. The resulting bounding box should > have the size of the figure if saved in eps, or size of the paper > ("letter" or "a4", I guess) if saved in ps. > > regards, > > JJ > > > best regards Matthias > > > >>  > > > > from matplotlib import use, rc > > use('PS') > > from pylab import figure, savefig > > > > rc('text', usetex=True) > > rc('text.latex', preamble="\usepackage{color}") > > > > f = figure() > > f.text(0.5, 0.5, r"{\color[rgb]{0,1,0} a } b {\color{blue} $\nu, \mu, > > \tau$}") > > > > savefig('test_tex_color.ps') > > > >>  > > > > On Monday 11 May 2009 20:36:58 JaeJoon Lee wrote: > >> > The resulting graph is not colored  but in the directory > >> > ~/.matplotlib/tex.cache/ the text is green, both in the dvi and the > >> > png file! > >> > > >> > It therefore seems to me that this is not completely hopeless but I > >> > cannot figure out how to proceed. > >> > >> As far as I know, in matplotlib, all the tex png output is treated as > >> grey internally (the only exception I know of is ps backend, e.g., > >> your example will show you a correct color if you save it as ps). I > >> guess this may have been a design decision. > >> As far as I can see, MPL currently does not support texts with varying > >> font properties (size, color, font). > >> One possible workaround for this could be using the latex typesetting > >> as you tried. However, supporting this within the current text > >> framework of matplotlib would be difficult and may not be a good idea. > >> > >> > >> However, I guess there are a few workarounds you may consider to use > >> (but unfortunately I think none of them are easy to work with). So, if > >> you describe where you intend to use multicolor text, I'll try to > >> give some example appropriate for your situation. Multicolor text in > >> figure title or simple annotation would be relatively simple. > >> Multicolor text in legend label seems to be more difficult, but > >> should be doable. > >> > >> JJ 
From: JaeJoon Lee <lee.j.joon@gm...>  20090513 18:48:27

Hmm, I have no idea what is wrong and I'm afraid that there is not much I can do. ps backend undergoes several steps (tex  dvi  ps  [distiller]) to produce the final output, and it is hard to track down the problem without actually reproducing one. Just in case, can you change your distiller option and see if it makes any difference? rc("ps", usedistiller="ghostscript") # this would be the default or rc("ps", usedistiller="xpdf") JJ On Wed, May 13, 2009 at 3:22 AM, Matthias Michler <MatthiasMichler@...> wrote: > Hi JaeJoon, > > I updated to svnrevision 7099 and the problem (hidden part of b) still > exists. Do you have any idea what I'm doing wrong? > > Thanks in advance for any hints. > > best regards Matthias > > > On Tuesday 12 May 2009 20:46:06 JaeJoon Lee wrote: >> On Tue, May 12, 2009 at 5:04 AM, Matthias Michler >> >> <MatthiasMichler@...> wrote: >> > Hello list, >> > >> > I'm not sure that following problem also occurs for Sebastian, but if I >> > use PSbackend in the below script I get the attached output, where the >> > upper part of the b is somehow hidden (matplotlibversion 0.98.6svn). >> > Is this a problem of matplotlib or did I miss something in the >> > texhandling? >> >> Unfortunately, I don't see such problem, although the problem seems to >> be due to a wrong bounding box. >> >> Are you using the most recent svn? There has been some recent changes >> in ps backend. Before the changes (r7068, r7074), the ps backend tried >> to adjust the bounding box of the output ps file. However, as far as I >> can see, this often gave a wrong bounding box (and I guess your >> problem might be related with this issue). The above mentioned changes >> somehow bypass that bbox adjustment. The resulting bounding box should >> have the size of the figure if saved in eps, or size of the paper >> ("letter" or "a4", I guess) if saved in ps. >> >> regards, >> >> JJ >> >> > best regards Matthias >> > >> >>  >> > >> > from matplotlib import use, rc >> > use('PS') >> > from pylab import figure, savefig >> > >> > rc('text', usetex=True) >> > rc('text.latex', preamble="\usepackage{color}") >> > >> > f = figure() >> > f.text(0.5, 0.5, r"{\color[rgb]{0,1,0} a } b {\color{blue} $\nu, \mu, >> > \tau$}") >> > >> > savefig('test_tex_color.ps') >> > >> >>  >> > >> > On Monday 11 May 2009 20:36:58 JaeJoon Lee wrote: >> >> > The resulting graph is not colored  but in the directory >> >> > ~/.matplotlib/tex.cache/ the text is green, both in the dvi and the >> >> > png file! >> >> > >> >> > It therefore seems to me that this is not completely hopeless but I >> >> > cannot figure out how to proceed. >> >> >> >> As far as I know, in matplotlib, all the tex png output is treated as >> >> grey internally (the only exception I know of is ps backend, e.g., >> >> your example will show you a correct color if you save it as ps). I >> >> guess this may have been a design decision. >> >> As far as I can see, MPL currently does not support texts with varying >> >> font properties (size, color, font). >> >> One possible workaround for this could be using the latex typesetting >> >> as you tried. However, supporting this within the current text >> >> framework of matplotlib would be difficult and may not be a good idea. >> >> >> >> >> >> However, I guess there are a few workarounds you may consider to use >> >> (but unfortunately I think none of them are easy to work with). So, if >> >> you describe where you intend to use multicolor text, I'll try to >> >> give some example appropriate for your situation. Multicolor text in >> >> figure title or simple annotation would be relatively simple. >> >> Multicolor text in legend label seems to be more difficult, but >> >> should be doable. >> >> >> >> JJ > >  > The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your > production scanning environment may not be a perfect world  but thanks to > Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700 > Series Scanner you'll get full speed at 300 dpi even with all image > processing features enabled. http://p.sf.net/sfu/kodakcom > _______________________________________________ > Matplotlibusers mailing list > Matplotlibusers@... > https://lists.sourceforge.net/lists/listinfo/matplotlibusers > 
From: Matthias Michler <MatthiasMichler@gm...>  20090514 07:08:50
Attachments:
test_tex_color_ghostscript.ps
test_tex_color_xpdf.ps

Hi JaeJoon, thank you very much for taking the time and for your suggestions. Indeed the different distillers yield different output as you can see in the attached pics. Does this mean that this behaviour is due to tex / the installed distiller or are different distillers differently handled in matplotlib? Especially the different used papersize A4/Letter vs. small region around text seems to be remarkable. best regards Matthias On Wednesday 13 May 2009 20:48:09 JaeJoon Lee wrote: > Hmm, I have no idea what is wrong and I'm afraid that there is not > much I can do. > ps backend undergoes several steps (tex  dvi  ps  [distiller]) to > produce the final output, and it is hard to track down the problem > without actually reproducing one. > > Just in case, can you change your distiller option and see if it makes > any difference? > > rc("ps", usedistiller="ghostscript") # this would be the default > > or > > rc("ps", usedistiller="xpdf") > > JJ > > > > On Wed, May 13, 2009 at 3:22 AM, Matthias Michler > > <MatthiasMichler@...> wrote: > > Hi JaeJoon, > > > > I updated to svnrevision 7099 and the problem (hidden part of b) still > > exists. Do you have any idea what I'm doing wrong? > > > > Thanks in advance for any hints. > > > > best regards Matthias > > > > On Tuesday 12 May 2009 20:46:06 JaeJoon Lee wrote: > >> On Tue, May 12, 2009 at 5:04 AM, Matthias Michler > >> > >> <MatthiasMichler@...> wrote: > >> > Hello list, > >> > > >> > I'm not sure that following problem also occurs for Sebastian, but if > >> > I use PSbackend in the below script I get the attached output, where > >> > the upper part of the b is somehow hidden (matplotlibversion > >> > 0.98.6svn). Is this a problem of matplotlib or did I miss something in > >> > the texhandling? > >> > >> Unfortunately, I don't see such problem, although the problem seems to > >> be due to a wrong bounding box. > >> > >> Are you using the most recent svn? There has been some recent changes > >> in ps backend. Before the changes (r7068, r7074), the ps backend tried > >> to adjust the bounding box of the output ps file. However, as far as I > >> can see, this often gave a wrong bounding box (and I guess your > >> problem might be related with this issue). The above mentioned changes > >> somehow bypass that bbox adjustment. The resulting bounding box should > >> have the size of the figure if saved in eps, or size of the paper > >> ("letter" or "a4", I guess) if saved in ps. > >> > >> regards, > >> > >> JJ > >> > >> > best regards Matthias > >> > > >> >>  > >> > > >> > from matplotlib import use, rc > >> > use('PS') > >> > from pylab import figure, savefig > >> > > >> > rc('text', usetex=True) > >> > rc('text.latex', preamble="\usepackage{color}") > >> > > >> > f = figure() > >> > f.text(0.5, 0.5, r"{\color[rgb]{0,1,0} a } b {\color{blue} $\nu, \mu, > >> > \tau$}") > >> > > >> > savefig('test_tex_color.ps') > >> > > >> >>  > >> > > >> > On Monday 11 May 2009 20:36:58 JaeJoon Lee wrote: > >> >> > The resulting graph is not colored  but in the directory > >> >> > ~/.matplotlib/tex.cache/ the text is green, both in the dvi and the > >> >> > png file! > >> >> > > >> >> > It therefore seems to me that this is not completely hopeless but I > >> >> > cannot figure out how to proceed. > >> >> > >> >> As far as I know, in matplotlib, all the tex png output is treated as > >> >> grey internally (the only exception I know of is ps backend, e.g., > >> >> your example will show you a correct color if you save it as ps). I > >> >> guess this may have been a design decision. > >> >> As far as I can see, MPL currently does not support texts with > >> >> varying font properties (size, color, font). > >> >> One possible workaround for this could be using the latex typesetting > >> >> as you tried. However, supporting this within the current text > >> >> framework of matplotlib would be difficult and may not be a good > >> >> idea. > >> >> > >> >> > >> >> However, I guess there are a few workarounds you may consider to use > >> >> (but unfortunately I think none of them are easy to work with). So, > >> >> if you describe where you intend to use multicolor text, I'll try to > >> >> give some example appropriate for your situation. Multicolor text in > >> >> figure title or simple annotation would be relatively simple. > >> >> Multicolor text in legend label seems to be more difficult, but > >> >> should be doable. > >> >> > >> >> JJ > > > >  > > The NEW KODAK i700 Series Scanners deliver under ANY circumstances! > > Your production scanning environment may not be a perfect world  but > > thanks to Kodak, there's a perfect scanner to get the job done! With the > > NEW KODAK i700 Series Scanner you'll get full speed at 300 dpi even with > > all image processing features enabled. http://p.sf.net/sfu/kodakcom > > _______________________________________________ > > Matplotlibusers mailing list > > Matplotlibusers@... > > https://lists.sourceforge.net/lists/listinfo/matplotlibusers 
Sign up for the SourceForge newsletter:
No, thanks