You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(3) |
Jun
|
Jul
|
Aug
(12) |
Sep
(12) |
Oct
(56) |
Nov
(65) |
Dec
(37) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(59) |
Feb
(78) |
Mar
(153) |
Apr
(205) |
May
(184) |
Jun
(123) |
Jul
(171) |
Aug
(156) |
Sep
(190) |
Oct
(120) |
Nov
(154) |
Dec
(223) |
2005 |
Jan
(184) |
Feb
(267) |
Mar
(214) |
Apr
(286) |
May
(320) |
Jun
(299) |
Jul
(348) |
Aug
(283) |
Sep
(355) |
Oct
(293) |
Nov
(232) |
Dec
(203) |
2006 |
Jan
(352) |
Feb
(358) |
Mar
(403) |
Apr
(313) |
May
(165) |
Jun
(281) |
Jul
(316) |
Aug
(228) |
Sep
(279) |
Oct
(243) |
Nov
(315) |
Dec
(345) |
2007 |
Jan
(260) |
Feb
(323) |
Mar
(340) |
Apr
(319) |
May
(290) |
Jun
(296) |
Jul
(221) |
Aug
(292) |
Sep
(242) |
Oct
(248) |
Nov
(242) |
Dec
(332) |
2008 |
Jan
(312) |
Feb
(359) |
Mar
(454) |
Apr
(287) |
May
(340) |
Jun
(450) |
Jul
(403) |
Aug
(324) |
Sep
(349) |
Oct
(385) |
Nov
(363) |
Dec
(437) |
2009 |
Jan
(500) |
Feb
(301) |
Mar
(409) |
Apr
(486) |
May
(545) |
Jun
(391) |
Jul
(518) |
Aug
(497) |
Sep
(492) |
Oct
(429) |
Nov
(357) |
Dec
(310) |
2010 |
Jan
(371) |
Feb
(657) |
Mar
(519) |
Apr
(432) |
May
(312) |
Jun
(416) |
Jul
(477) |
Aug
(386) |
Sep
(419) |
Oct
(435) |
Nov
(320) |
Dec
(202) |
2011 |
Jan
(321) |
Feb
(413) |
Mar
(299) |
Apr
(215) |
May
(284) |
Jun
(203) |
Jul
(207) |
Aug
(314) |
Sep
(321) |
Oct
(259) |
Nov
(347) |
Dec
(209) |
2012 |
Jan
(322) |
Feb
(414) |
Mar
(377) |
Apr
(179) |
May
(173) |
Jun
(234) |
Jul
(295) |
Aug
(239) |
Sep
(276) |
Oct
(355) |
Nov
(144) |
Dec
(108) |
2013 |
Jan
(170) |
Feb
(89) |
Mar
(204) |
Apr
(133) |
May
(142) |
Jun
(89) |
Jul
(160) |
Aug
(180) |
Sep
(69) |
Oct
(136) |
Nov
(83) |
Dec
(32) |
2014 |
Jan
(71) |
Feb
(90) |
Mar
(161) |
Apr
(117) |
May
(78) |
Jun
(94) |
Jul
(60) |
Aug
(83) |
Sep
(102) |
Oct
(132) |
Nov
(154) |
Dec
(96) |
2015 |
Jan
(45) |
Feb
(138) |
Mar
(176) |
Apr
(132) |
May
(119) |
Jun
(124) |
Jul
(77) |
Aug
(31) |
Sep
(34) |
Oct
(22) |
Nov
(23) |
Dec
(9) |
2016 |
Jan
(26) |
Feb
(17) |
Mar
(10) |
Apr
(8) |
May
(4) |
Jun
(8) |
Jul
(6) |
Aug
(5) |
Sep
(9) |
Oct
(4) |
Nov
|
Dec
|
2017 |
Jan
(5) |
Feb
(7) |
Mar
(1) |
Apr
(5) |
May
|
Jun
(3) |
Jul
(6) |
Aug
(1) |
Sep
|
Oct
(2) |
Nov
(1) |
Dec
|
2018 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2025 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
|
|
|
|
|
1
(2) |
2
(1) |
3
(17) |
4
(9) |
5
(2) |
6
(5) |
7
(8) |
8
(11) |
9
(6) |
10
(6) |
11
(21) |
12
(21) |
13
(17) |
14
(25) |
15
(15) |
16
(2) |
17
|
18
(9) |
19
(22) |
20
(25) |
21
(31) |
22
(19) |
23
(2) |
24
(5) |
25
(19) |
26
(10) |
27
(13) |
28
(14) |
29
(20) |
30
(5) |
31
(9) |
|
|
|
|
|
|
Jae-Joon Lee wrote: > Contour will work as expected if the axes is in log scale. See below. > > z = np.arange(100).reshape((10,10)) > x = np.logspace(0, 4, 10) > y = np.logspace(0, 4, 10) > > ax1 = subplot(121) > ax1.contour(np.log10(x), np.log10(y), z) > > ax2 = subplot(122) > ax2.set_xscale("log") > ax2.set_yscale("log") > ax2.contour(x, y, z) JJ, Actually, I think your example illustrates that there is a problem with the second approach--the first subplot generates straight lines, the second does not. The contour calculation itself really needs to be done in coordinates that are linear as displayed, because the contour locations are determined by linear interpolation. Adding support for log scales to make contour work right in your second example would be easy; making it work with more general transforms, and making it work when the transform changes after the call to contour, would be harder. I will have to look into this. Eric > > Regards, > > -JJ > > p.s. good to see another astronomer begin to use matplotlib. > > > On Mon, Jan 11, 2010 at 3:33 PM, Jonathan Slavin > <js...@cf...> wrote: >> Is there any way to simply make a contour plot with logarithmic axes >> using matplotlib? I found a workaround by plotting log10(x), log10(y), >> but it'd be nicer if it was more direct. >> >> As someone new to matplotlib (experienced in IDL) I'm finding much to >> like, but some things are more difficult for no clear reason. It would >> seem to me that whether the axes are logarithmic or not would be a nice >> thing to have as an attribute of the plot object. I'm not familiar yet >> with the matplotlib internals to know how difficult that would be to >> implement, but it sure would be convenient. >> >> Jon Slavin >> >> >> ------------------------------------------------------------------------------ >> This SF.Net email is sponsored by the Verizon Developer Community >> Take advantage of Verizon's best-in-class app development support >> A streamlined, 14 day to market process makes app distribution fast and easy >> Join now and get one step closer to millions of Verizon customers >> http://p.sf.net/sfu/verizon-dev2dev >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> > > ------------------------------------------------------------------------------ > This SF.Net email is sponsored by the Verizon Developer Community > Take advantage of Verizon's best-in-class app development support > A streamlined, 14 day to market process makes app distribution fast and easy > Join now and get one step closer to millions of Verizon customers > http://p.sf.net/sfu/verizon-dev2dev > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Jae-Joon Lee wrote: > My guess is that somehow the output format of bbox device in the > recent ghostscript has changed. > > What kind of output do you get when you run > >> gs -dBATCH -dNOPAUSE -sDEVICE=bbox test.eps > > in your shell (replace "test.eps" with any eps file you have) > > I get > > GPL Ghostscript 8.61 (2007年11月21日) > Copyright (C) 2007 Artifex Software, Inc. All rights reserved. > This software comes with NO WARRANTY: see the file PUBLIC for details. > %%BoundingBox: 71 214 541 578 > %%HiResBoundingBox: 71.207998 214.811993 540.629984 577.169982 > > The last two lines are what matplotlib requires to work. I get GPL Ghostscript 8.70 (2009年07月31日) Copyright (C) 2009 Artifex Software, Inc. All rights reserved. This software comes with NO WARRANTY: see the file PUBLIC for details. %%BoundingBox: 69 210 541 574 %%HiResBoundingBox: 69.155998 210.131994 540.203960 573.335983 which looks pretty similar to me > > Meanwhile, can you test if following changes make things work? > > In lib/matplotlib/backends/backend_ps.py, comment out following two > lines near the end of the function "xpdf_distill" (around line 1458 in > my code), i.e., > > if eps: > pstoeps(tmpfile, bbox) > > It will not raise the error, but may give you a wrong bbox. > They were at line 1363. Now it works but with the wrong bbox as you predicted. Thanks for help so far. Any more ideas? I'll try the svn if it is just a case of checking it out and compiling. John.
Contour will work as expected if the axes is in log scale. See below. z = np.arange(100).reshape((10,10)) x = np.logspace(0, 4, 10) y = np.logspace(0, 4, 10) ax1 = subplot(121) ax1.contour(np.log10(x), np.log10(y), z) ax2 = subplot(122) ax2.set_xscale("log") ax2.set_yscale("log") ax2.contour(x, y, z) Regards, -JJ p.s. good to see another astronomer begin to use matplotlib. On Mon, Jan 11, 2010 at 3:33 PM, Jonathan Slavin <js...@cf...> wrote: > Is there any way to simply make a contour plot with logarithmic axes > using matplotlib? I found a workaround by plotting log10(x), log10(y), > but it'd be nicer if it was more direct. > > As someone new to matplotlib (experienced in IDL) I'm finding much to > like, but some things are more difficult for no clear reason. It would > seem to me that whether the axes are logarithmic or not would be a nice > thing to have as an attribute of the plot object. I'm not familiar yet > with the matplotlib internals to know how difficult that would be to > implement, but it sure would be convenient. > > Jon Slavin > > > ------------------------------------------------------------------------------ > This SF.Net email is sponsored by the Verizon Developer Community > Take advantage of Verizon's best-in-class app development support > A streamlined, 14 day to market process makes app distribution fast and easy > Join now and get one step closer to millions of Verizon customers > http://p.sf.net/sfu/verizon-dev2dev > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users >
My guess is that somehow the output format of bbox device in the recent ghostscript has changed. What kind of output do you get when you run > gs -dBATCH -dNOPAUSE -sDEVICE=bbox test.eps in your shell (replace "test.eps" with any eps file you have) I get GPL Ghostscript 8.61 (2007年11月21日) Copyright (C) 2007 Artifex Software, Inc. All rights reserved. This software comes with NO WARRANTY: see the file PUBLIC for details. %%BoundingBox: 71 214 541 578 %%HiResBoundingBox: 71.207998 214.811993 540.629984 577.169982 The last two lines are what matplotlib requires to work. Meanwhile, can you test if following changes make things work? In lib/matplotlib/backends/backend_ps.py, comment out following two lines near the end of the function "xpdf_distill" (around line 1458 in my code), i.e., if eps: pstoeps(tmpfile, bbox) It will not raise the error, but may give you a wrong bbox. Regards, -JJ On Mon, Jan 11, 2010 at 3:11 PM, John Reid <j....@ma...> wrote: > Thanks for looking at this. I upgraded to 99.1.1 (although the tar file > was named 99.1.2) and I got the same error message. When I played with > the ps.usedistiller option I found it only doesn't work when I set > ps.usedistiller to xpdf. With False or ghostscript it works ok but gives > me output with different page sizes. AFAIK xpdf is the way to go for > publication quality graphics. Do you know how I can get it to work? Is > it worth trying the svn version? > > Thanks, > John. > > > > Jae-Joon Lee wrote: >> You code works okay with the current svn. >> >> See if changing the distiller option makes any difference >> ("ps.usedistiller" in the rc file). >> >> The best would be for you to upgrade to the recent release of >> matplotlib if possible. >> >> Regards, >> >> -JJ >> >> >> On Mon, Jan 11, 2010 at 8:35 AM, John Reid <j....@ma...> wrote: >>> Hi, >>> >>> I'm using matplotlib 0.98.5.2 on Ubuntu with Ghostscript 8.70. The >>> following code produces the following error. Can anyone verify whether >>> this a problem with my installation or with matplotlib? >>> >>> import pylab as P >>> P.figure() >>> width=.4 >>> x1 = [-0.4, 0.6, 1.6, 2.6, 3.6, 4.6, 5.6] >>> y1 = [1.0, 0.96875, 0.77584381616639686, 0.54678532728659146, >>> 0.4043846450263317, 0.28361561411668612, 1.0] >>> x2 = [0, 1, 2, 3, 4, 5, 6] >>> y2 = [1.0, 0.97032301818547173, 0.77110383361936519, >>> 0.54221305796207875, 0.40019201884735922, 0.28326596333427007, 1.0] >>> P.bar(x1, y1, color='blue' , width=width, label='nodes') >>> P.bar(x2, y2, color='green', width=width, label='occurrences') >>> P.savefig('fraction-evaluated.eps') >>> P.close() >>> >>> >>> >>> >>> /home/john/Dev/MyProjects/Bio/MotifSearch/python/stem.py in <module>() >>> 246 P.bar(x1, y1, color='blue' , width=width, label='nodes') >>> 247 P.bar(x2, y2, color='green', width=width, label='occurrences') >>> --> 248 P.savefig('fraction-evaluated.eps') >>> 249 P.close() >>> 250 raise >>> >>> /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/pyplot.pyc >>> in savefig(*args, **kwargs) >>> 343 def savefig(*args, **kwargs): >>> 344 fig = gcf() >>> --> 345 return fig.savefig(*args, **kwargs) >>> 346 if Figure.savefig.__doc__ is not None: >>> 347 savefig.__doc__ = dedent(Figure.savefig.__doc__) >>> >>> /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/figure.pyc >>> in savefig(self, *args, **kwargs) >>> 988 patch.set_alpha(0.0) >>> 989 >>> --> 990 self.canvas.print_figure(*args, **kwargs) >>> 991 >>> 992 if transparent: >>> >>> /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_wxagg.pyc >>> in print_figure(self, filename, *args, **kwargs) >>> 99 def print_figure(self, filename, *args, **kwargs): >>> 100 # Use pure Agg renderer to draw >>> --> 101 FigureCanvasAgg.print_figure(self, filename, *args, >>> **kwargs) >>> 102 # Restore the current view; this is needed because the >>> 103 # artist contains methods rely on particular attributes >>> >>> /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backend_bases.pyc >>> in print_figure(self, filename, dpi, facecolor, edgecolor, orientation, >>> format, **kwargs) >>> 1417 edgecolor=edgecolor, >>> 1418 orientation=orientation, >>> -> 1419 **kwargs) >>> 1420 finally: >>> 1421 self.figure.dpi = origDPI >>> >>> /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backend_bases.pyc >>> in print_eps(self, *args, **kwargs) >>> 1306 from backends.backend_ps import FigureCanvasPS # lazy >>> import >>> 1307 ps = self.switch_backends(FigureCanvasPS) >>> -> 1308 return ps.print_eps(*args, **kwargs) >>> 1309 >>> 1310 def print_pdf(self, *args, **kwargs): >>> >>> /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc >>> in print_eps(self, outfile, *args, **kwargs) >>> 867 >>> 868 def print_eps(self, outfile, *args, **kwargs): >>> --> 869 return self._print_ps(outfile, 'eps', *args, **kwargs) >>> 870 >>> 871 def _print_ps(self, outfile, format, *args, **kwargs): >>> >>> /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc >>> in _print_ps(self, outfile, format, *args, **kwargs) >>> 893 else: >>> 894 self._print_figure(outfile, format, imagedpi, >>> facecolor, edgecolor, >>> --> 895 orientation, isLandscape, papertype) >>> 896 >>> 897 def _print_figure(self, outfile, format, dpi=72, >>> facecolor='w', edgecolor='w', >>> >>> /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc >>> in _print_figure(self, outfile, format, dpi, facecolor, edgecolor, >>> orientation, isLandscape, papertype) >>> 1036 gs_distill(tmpfile, isEPSF, ptype=papertype, bbox=bbox) >>> 1037 elif rcParams['ps.usedistiller'] == 'xpdf': >>> -> 1038 xpdf_distill(tmpfile, isEPSF, ptype=papertype, >>> bbox=bbox) >>> 1039 >>> 1040 if passed_in_file_object: >>> >>> /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc >>> in xpdf_distill(tmpfile, eps, ptype, bbox) >>> 1311 shutil.move(psfile, tmpfile) >>> 1312 if eps: >>> -> 1313 pstoeps(tmpfile, bbox) >>> 1314 for fname in glob.glob(tmpfile+'.*'): >>> 1315 os.remove(fname) >>> >>> /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc >>> in pstoeps(tmpfile, bbox) >>> 1362 Convert the postscript to encapsulated postscript. >>> 1363 """ >>> -> 1364 bbox_info = get_bbox(tmpfile, bbox) >>> 1365 >>> 1366 epsfile = tmpfile + '.eps' >>> >>> /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc >>> in get_bbox(tmpfile, bbox) >>> 1336 else: >>> 1337 raise RuntimeError('Ghostscript was not able to extract >>> a bounding box.\ >>> -> 1338 Here is the Ghostscript output:\n\n%s'% bbox_info) >>> 1339 l, b, r, t = [float(i) for i in bbox_info.split()[-4:]] >>> 1340 >>> >>> RuntimeError: Ghostscript was not able to extract a bounding box.Here is >>> the Ghostscript output: >>> >>> GPL Ghostscript 8.70: Unrecoverable error, exit code 1 >>> >>> > >>> /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.py(1338)get_bbox() >>> 1337 raise RuntimeError('Ghostscript was not able to extract >>> a bounding box.\ >>> -> 1338 Here is the Ghostscript output:\n\n%s'% bbox_info) >>> 1339 l, b, r, t = [float(i) for i in bbox_info.split()[-4:]] >>> >>> >>> ------------------------------------------------------------------------------ >>> This SF.Net email is sponsored by the Verizon Developer Community >>> Take advantage of Verizon's best-in-class app development support >>> A streamlined, 14 day to market process makes app distribution fast and easy >>> Join now and get one step closer to millions of Verizon customers >>> http://p.sf.net/sfu/verizon-dev2dev >>> _______________________________________________ >>> Matplotlib-users mailing list >>> Mat...@li... >>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >>> >> >> ------------------------------------------------------------------------------ >> This SF.Net email is sponsored by the Verizon Developer Community >> Take advantage of Verizon's best-in-class app development support >> A streamlined, 14 day to market process makes app distribution fast and easy >> Join now and get one step closer to millions of Verizon customers >> http://p.sf.net/sfu/verizon-dev2dev >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > ------------------------------------------------------------------------------ > This SF.Net email is sponsored by the Verizon Developer Community > Take advantage of Verizon's best-in-class app development support > A streamlined, 14 day to market process makes app distribution fast and easy > Join now and get one step closer to millions of Verizon customers > http://p.sf.net/sfu/verizon-dev2dev > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users >
Is there any way to simply make a contour plot with logarithmic axes using matplotlib? I found a workaround by plotting log10(x), log10(y), but it'd be nicer if it was more direct. As someone new to matplotlib (experienced in IDL) I'm finding much to like, but some things are more difficult for no clear reason. It would seem to me that whether the axes are logarithmic or not would be a nice thing to have as an attribute of the plot object. I'm not familiar yet with the matplotlib internals to know how difficult that would be to implement, but it sure would be convenient. Jon Slavin
OK JJ, After reading your explanation, I have tried my current Qt4Agg and PS backends. As you told coloring worked only with PS backend. See my sample test-snippets. plt.rcParams["text.latex.preamble"] = r"\usepackage{color}" plt.plot(range(10)); plt.ylabel("\color{red} {red}, \color{blue} {blue}"); plt.savefig("hello.png") See the saved png and ps files at http://ccnworks.googlecode.com/svn/trunk/hello.png http://ccnworks.googlecode.com/svn/trunk/hello.ps Another thing I noted in these images, Qt4Agg produced one looks much prettier to my eyes than the PS. What could be causing the jiggly rendering in the PS? Any ideas? On Mon, Jan 11, 2010 at 1:10 PM, Jae-Joon Lee <lee...@gm...> wrote: > First of all, to use "\color" with TeX, you need to use "color" > package, i.e., you need to modify your latex preamble to include that > package. This can be done by > > import matplotlib.pyplot as plt > plt.rcParams["text.latex.preamble"] = r"\usepackage{color}" > > I guess the error you encounter is because of this (I'm not sure as > the error message is slightly different in my machine). > > However, this WON'T work in general! > The color information in the dvi (or png) file is ignored in most > cases (the only exception I know is the ps backend which does not read > in dvi of png output). > So, if you only want ps output, you can use usetex with "\color" command. > > In matplotlib, a single Text object only have a single color > associated. So changing the color of the text within the string is be > hardly possible (except in the ps backend). So, I guess your best > option is to call "text" (or "annotate") multiple times with different > colors with fine-tuned text positions. > > FYI, It is possible to have two (or more) text instances of different > colors packed together (somewhat similar to this example > > http://matplotlib.sourceforge.net/plot_directive/users/plotting/examples/anchored_box04.hires.png > ), > > Regards, > > -JJ > > On Mon, Jan 11, 2010 at 11:13 AM, Gökhan Sever <gok...@gm...> > wrote: > > This seems like the solution. However when I try: > > > > I[1]: plt.plot(range(10)) > > I[2]: plt.ylabel(r"{\color{red} a red text}") > > > > It doesn't function and produce an ugly set of error messages: > > > > I[3]: ERROR: An unexpected error occurred while tokenizing input > > The following traceback may be corrupted or invalid > > The error message is: ('EOF in multi-line statement', (573, 0)) > > > > ERROR: An unexpected error occurred while tokenizing input > > The following traceback may be corrupted or invalid > > The error message is: ('EOF in multi-line statement', (573, 0)) > > > > ERROR: An unexpected error occurred while tokenizing input > > The following traceback may be corrupted or invalid > > The error message is: ('EOF in multi-line statement', (573, 0)) > > > > ERROR: An unexpected error occurred while tokenizing input > > The following traceback may be corrupted or invalid > > The error message is: ('EOF in multi-line statement', (573, 0)) > > > > ERROR: An unexpected error occurred while tokenizing input > > The following traceback may be corrupted or invalid > > The error message is: ('EOF in multi-line statement', (566, 0)) > > > > > --------------------------------------------------------------------------- > > RuntimeError Traceback (most recent call > last) > > > > > /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/backends/backend_qt4.pyc > > in resizeEvent(self, event) > > 167 hinch = h/dpival > > 168 self.figure.set_size_inches( winch, hinch ) > > --> 169 self.draw() > > 170 self.update() > > 171 QtGui.QWidget.resizeEvent(self, event) > > > > > /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/backends/backend_qt4agg.pyc > > in draw(self) > > 128 if DEBUG: print "FigureCanvasQtAgg.draw", self > > 129 self.replot = True > > --> 130 FigureCanvasAgg.draw(self) > > 131 self.update() > > 132 > > > > > /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/backends/backend_agg.pyc > > in draw(self) > > 386 > > 387 self.renderer = self.get_renderer() > > --> 388 self.figure.draw(self.renderer) > > 389 > > 390 def get_renderer(self): > > > > /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/artist.pyc in > > draw_wrapper(artist, renderer, *kl) > > 53 def draw_wrapper(artist, renderer, *kl): > > 54 before(artist, renderer) > > ---> 55 draw(artist, renderer, *kl) > > 56 after(artist, renderer) > > 57 > > > > /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/figure.pyc in > > draw(self, renderer) > > 800 dsu.sort(key=itemgetter(0)) > > 801 for zorder, func, args in dsu: > > --> 802 func(*args) > > 803 > > 804 renderer.close_group('figure') > > > > /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/artist.pyc in > > draw_wrapper(artist, renderer, *kl) > > 53 def draw_wrapper(artist, renderer, *kl): > > 54 before(artist, renderer) > > ---> 55 draw(artist, renderer, *kl) > > 56 after(artist, renderer) > > 57 > > > > /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/axes.pyc in > > draw(self, renderer, inframe) > > 1755 > > 1756 for zorder, a in dsu: > > -> 1757 a.draw(renderer) > > 1758 > > 1759 renderer.close_group('axes') > > > > /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/artist.pyc in > > draw_wrapper(artist, renderer, *kl) > > 53 def draw_wrapper(artist, renderer, *kl): > > 54 before(artist, renderer) > > ---> 55 draw(artist, renderer, *kl) > > 56 after(artist, renderer) > > 57 > > > > /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/axis.pyc in > > draw(self, renderer, *args, **kwargs) > > 819 self._update_label_position(ticklabelBoxes, > ticklabelBoxes2) > > 820 > > --> 821 self.label.draw(renderer) > > 822 > > 823 self._update_offset_text_position(ticklabelBoxes, > > ticklabelBoxes2) > > > > /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/artist.pyc in > > draw_wrapper(artist, renderer, *kl) > > 53 def draw_wrapper(artist, renderer, *kl): > > 54 before(artist, renderer) > > ---> 55 draw(artist, renderer, *kl) > > 56 after(artist, renderer) > > 57 > > > > /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/text.pyc in > > draw(self, renderer) > > 547 renderer.open_group('text', self.get_gid()) > > 548 > > --> 549 bbox, info = self._get_layout(renderer) > > 550 trans = self.get_transform() > > 551 > > > > /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/text.pyc in > > _get_layout(self, renderer) > > 303 w, h, d = get_text_width_height_descent(clean_line, > > 304 > > self._fontproperties, > > --> 305 > ismath=ismath) > > 306 if baseline is None: > > 307 baseline = h - d > > > > > /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/backends/backend_agg.pyc > > in get_text_width_height_descent(self, s, prop, ismath) > > 169 fontsize = prop.get_size_in_points() > > 170 w, h, d = texmanager.get_text_width_height_descent(s, > > fontsize, > > --> 171 > > renderer=self) > > 172 return w, h, d > > 173 > > > > /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/texmanager.pyc > in > > get_text_width_height_descent(self, tex, fontsize, renderer) > > 599 else: > > 600 # use dviread. It sometimes returns a wrong descent. > > > > --> 601 dvifile = self.make_dvi(tex, fontsize) > > 602 dvi = dviread.Dvi(dvifile, 72*dpi_fraction) > > 603 page = iter(dvi).next() > > > > /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/texmanager.pyc > in > > make_dvi(self, tex, fontsize) > > 369 if exit_status or not exists: > > 370 raise RuntimeError(('LaTeX was not able to > process > > the following \ > > --> 371 string:\n%s\nHere is the full report generated by LaTeX: \n\n'% > > repr(tex)) + report) > > 372 else: mpl.verbose.report(report, 'debug') > > 373 for fname in glob.glob(basefile+'*'): > > > > RuntimeError: LaTeX was not able to process the following string: > > '{\\color{red} a red text}' > > Here is the full report generated by LaTeX: > > > > This is pdfTeXk, Version 3.141592-1.40.3 (Web2C 7.5.6) > > %&-line parsing enabled. > > entering extended mode > > (./f5e3ddba2ab4bf5147d4e32e96deb043.tex > > LaTeX2e <2005年12月01日> > > Babel <v3.8h> and hyphenation patterns for english, usenglishmax, > dumylang, > > noh > > yphenation, arabic, basque, bulgarian, coptic, welsh, czech, slovak, > german, > > ng > > erman, danish, esperanto, spanish, catalan, galician, estonian, farsi, > > finnish, > > french, greek, monogreek, ancientgreek, croatian, hungarian, > interlingua, > > ibyc > > us, indonesian, icelandic, italian, latin, mongolian, dutch, norsk, > polish, > > por > > tuguese, pinyin, romanian, russian, slovenian, uppersorbian, serbian, > > swedish, > > turkish, ukenglish, ukrainian, loaded. > > (/usr/share/texmf/tex/latex/base/article.cls > > Document Class: article 2005年09月16日 v1.4f Standard LaTeX document class > > (/usr/share/texmf/tex/latex/base/size10.clo)) > > (/usr/share/texmf/tex/latex/type1cm/type1cm.sty) > > (/usr/share/texmf/tex/latex/psnfss/helvet.sty > > (/usr/share/texmf/tex/latex/graphics/keyval.sty)) > > (/usr/share/texmf/tex/latex/psnfss/courier.sty) > > (/usr/share/texmf/tex/latex/base/textcomp.sty > > (/usr/share/texmf/tex/latex/base/ts1enc.def)) > > (/usr/share/texmf/tex/latex/geometry/geometry.sty > > > > Package geometry Warning: Over-specification in `h'-direction. > > `width' (5058.9pt) is ignored. > > > > > > Package geometry Warning: Over-specification in `v'-direction. > > `height' (5058.9pt) is ignored. > > > > ) > > No file f5e3ddba2ab4bf5147d4e32e96deb043.aux. > > (/usr/share/texmf/tex/latex/base/ts1cmr.fd) > > (/usr/share/texmf/tex/latex/psnfss/ot1pnc.fd) > > (/usr/share/texmf/tex/latex/psnfss/ot1phv.fd) > > ! Undefined control sequence. > > l.12 ...ze{12.000000}{15.000000}{\sffamily {\color > > {red} a red text}} > > [1] (./f5e3ddba2ab4bf5147d4e32e96deb043.aux) ) > > (see the transcript file for additional information) > > Output written on f5e3ddba2ab4bf5147d4e32e96deb043.dvi (1 page, 224 > bytes). > > Transcript written on f5e3ddba2ab4bf5147d4e32e96deb043.log. > > > > > > Interestingly tex_demo.py works fine and renders the text properly onto > the > > figure. > > > > > > On Mon, Jan 11, 2010 at 4:36 AM, Damon McDougall < > D.M...@wa...> > > wrote: > >> > >> Hi Gökhan, > >> Do you have usetex=True set? If so, have you tried the LaTeX command > >> sequence \color{red}{Red text goes here} ? > >> Regards, > >> -- Damon > >> > >> -------------------------- > >> Damon McDougall > >> Mathematics Institute > >> University of Warwick > >> Coventry > >> CV4 7AL > >> d.m...@wa... > >> On 11 Jan 2010, at 05:48, Gökhan Sever wrote: > >> > >> Hello, > >> > >> Is there a way to color words differently in a label or title, for > >> example: > >> > >> ylabel("measurement 1 (in red color)" , "measurement 2 (in blue color)") > >> to match with the plotted line colors? > >> > >> Thanks. > >> > >> -- > >> Gökhan > >> > >> > ------------------------------------------------------------------------------ > >> This SF.Net email is sponsored by the Verizon Developer Community > >> Take advantage of Verizon's best-in-class app development support > >> A streamlined, 14 day to market process makes app distribution fast and > >> easy > >> Join now and get one step closer to millions of Verizon customers > >> http://p.sf.net/sfu/verizon-dev2dev > >> _______________________________________________ > >> Matplotlib-users mailing list > >> Mat...@li... > >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users > >> > > > > > > > > -- > > Gökhan > > > > > ------------------------------------------------------------------------------ > > This SF.Net email is sponsored by the Verizon Developer Community > > Take advantage of Verizon's best-in-class app development support > > A streamlined, 14 day to market process makes app distribution fast and > easy > > Join now and get one step closer to millions of Verizon customers > > http://p.sf.net/sfu/verizon-dev2dev > > _______________________________________________ > > Matplotlib-users mailing list > > Mat...@li... > > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > > > -- Gökhan
On Mon, Jan 11, 2010 at 2:38 PM, Dominik Szczerba <do...@it...> wrote: > Hmmm, that property really deserves its own rc param, but if you do not > like it, it should at least be somewhere automatically set to the > current background color to be resistant against people like me ;) I > would be happy to have such a fix... > I just committed a change that makes the face- and edgecolor of the legend patch to match those of the axes patch. The reason I'm not very kin to introduce such new rc parameters is partly that, we actually needs a lot of rc parameters, not just the facecolor of the legend parch. What about the edgecolor of the legend patch, or the linewidth? Or the color of the legend text. What about the colors of the parch around the annotation text? I don't think it is desirable to add a new rc parameter for every property that needs to be customized. In my personal opinion, one of the the best way to customize the plot is to have something like CSS that supports inheritance of properties. So, I'm inclined to leave it as is. But other developers may have different thoughts. Regards, -JJ
Thanks for looking at this. I upgraded to 99.1.1 (although the tar file was named 99.1.2) and I got the same error message. When I played with the ps.usedistiller option I found it only doesn't work when I set ps.usedistiller to xpdf. With False or ghostscript it works ok but gives me output with different page sizes. AFAIK xpdf is the way to go for publication quality graphics. Do you know how I can get it to work? Is it worth trying the svn version? Thanks, John. Jae-Joon Lee wrote: > You code works okay with the current svn. > > See if changing the distiller option makes any difference > ("ps.usedistiller" in the rc file). > > The best would be for you to upgrade to the recent release of > matplotlib if possible. > > Regards, > > -JJ > > > On Mon, Jan 11, 2010 at 8:35 AM, John Reid <j....@ma...> wrote: >> Hi, >> >> I'm using matplotlib 0.98.5.2 on Ubuntu with Ghostscript 8.70. The >> following code produces the following error. Can anyone verify whether >> this a problem with my installation or with matplotlib? >> >> import pylab as P >> P.figure() >> width=.4 >> x1 = [-0.4, 0.6, 1.6, 2.6, 3.6, 4.6, 5.6] >> y1 = [1.0, 0.96875, 0.77584381616639686, 0.54678532728659146, >> 0.4043846450263317, 0.28361561411668612, 1.0] >> x2 = [0, 1, 2, 3, 4, 5, 6] >> y2 = [1.0, 0.97032301818547173, 0.77110383361936519, >> 0.54221305796207875, 0.40019201884735922, 0.28326596333427007, 1.0] >> P.bar(x1, y1, color='blue' , width=width, label='nodes') >> P.bar(x2, y2, color='green', width=width, label='occurrences') >> P.savefig('fraction-evaluated.eps') >> P.close() >> >> >> >> >> /home/john/Dev/MyProjects/Bio/MotifSearch/python/stem.py in <module>() >> 246 P.bar(x1, y1, color='blue' , width=width, label='nodes') >> 247 P.bar(x2, y2, color='green', width=width, label='occurrences') >> --> 248 P.savefig('fraction-evaluated.eps') >> 249 P.close() >> 250 raise >> >> /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/pyplot.pyc >> in savefig(*args, **kwargs) >> 343 def savefig(*args, **kwargs): >> 344 fig = gcf() >> --> 345 return fig.savefig(*args, **kwargs) >> 346 if Figure.savefig.__doc__ is not None: >> 347 savefig.__doc__ = dedent(Figure.savefig.__doc__) >> >> /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/figure.pyc >> in savefig(self, *args, **kwargs) >> 988 patch.set_alpha(0.0) >> 989 >> --> 990 self.canvas.print_figure(*args, **kwargs) >> 991 >> 992 if transparent: >> >> /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_wxagg.pyc >> in print_figure(self, filename, *args, **kwargs) >> 99 def print_figure(self, filename, *args, **kwargs): >> 100 # Use pure Agg renderer to draw >> --> 101 FigureCanvasAgg.print_figure(self, filename, *args, >> **kwargs) >> 102 # Restore the current view; this is needed because the >> 103 # artist contains methods rely on particular attributes >> >> /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backend_bases.pyc >> in print_figure(self, filename, dpi, facecolor, edgecolor, orientation, >> format, **kwargs) >> 1417 edgecolor=edgecolor, >> 1418 orientation=orientation, >> -> 1419 **kwargs) >> 1420 finally: >> 1421 self.figure.dpi = origDPI >> >> /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backend_bases.pyc >> in print_eps(self, *args, **kwargs) >> 1306 from backends.backend_ps import FigureCanvasPS # lazy >> import >> 1307 ps = self.switch_backends(FigureCanvasPS) >> -> 1308 return ps.print_eps(*args, **kwargs) >> 1309 >> 1310 def print_pdf(self, *args, **kwargs): >> >> /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc >> in print_eps(self, outfile, *args, **kwargs) >> 867 >> 868 def print_eps(self, outfile, *args, **kwargs): >> --> 869 return self._print_ps(outfile, 'eps', *args, **kwargs) >> 870 >> 871 def _print_ps(self, outfile, format, *args, **kwargs): >> >> /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc >> in _print_ps(self, outfile, format, *args, **kwargs) >> 893 else: >> 894 self._print_figure(outfile, format, imagedpi, >> facecolor, edgecolor, >> --> 895 orientation, isLandscape, papertype) >> 896 >> 897 def _print_figure(self, outfile, format, dpi=72, >> facecolor='w', edgecolor='w', >> >> /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc >> in _print_figure(self, outfile, format, dpi, facecolor, edgecolor, >> orientation, isLandscape, papertype) >> 1036 gs_distill(tmpfile, isEPSF, ptype=papertype, bbox=bbox) >> 1037 elif rcParams['ps.usedistiller'] == 'xpdf': >> -> 1038 xpdf_distill(tmpfile, isEPSF, ptype=papertype, >> bbox=bbox) >> 1039 >> 1040 if passed_in_file_object: >> >> /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc >> in xpdf_distill(tmpfile, eps, ptype, bbox) >> 1311 shutil.move(psfile, tmpfile) >> 1312 if eps: >> -> 1313 pstoeps(tmpfile, bbox) >> 1314 for fname in glob.glob(tmpfile+'.*'): >> 1315 os.remove(fname) >> >> /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc >> in pstoeps(tmpfile, bbox) >> 1362 Convert the postscript to encapsulated postscript. >> 1363 """ >> -> 1364 bbox_info = get_bbox(tmpfile, bbox) >> 1365 >> 1366 epsfile = tmpfile + '.eps' >> >> /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc >> in get_bbox(tmpfile, bbox) >> 1336 else: >> 1337 raise RuntimeError('Ghostscript was not able to extract >> a bounding box.\ >> -> 1338 Here is the Ghostscript output:\n\n%s'% bbox_info) >> 1339 l, b, r, t = [float(i) for i in bbox_info.split()[-4:]] >> 1340 >> >> RuntimeError: Ghostscript was not able to extract a bounding box.Here is >> the Ghostscript output: >> >> GPL Ghostscript 8.70: Unrecoverable error, exit code 1 >> >> > >> /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.py(1338)get_bbox() >> 1337 raise RuntimeError('Ghostscript was not able to extract >> a bounding box.\ >> -> 1338 Here is the Ghostscript output:\n\n%s'% bbox_info) >> 1339 l, b, r, t = [float(i) for i in bbox_info.split()[-4:]] >> >> >> ------------------------------------------------------------------------------ >> This SF.Net email is sponsored by the Verizon Developer Community >> Take advantage of Verizon's best-in-class app development support >> A streamlined, 14 day to market process makes app distribution fast and easy >> Join now and get one step closer to millions of Verizon customers >> http://p.sf.net/sfu/verizon-dev2dev >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> > > ------------------------------------------------------------------------------ > This SF.Net email is sponsored by the Verizon Developer Community > Take advantage of Verizon's best-in-class app development support > A streamlined, 14 day to market process makes app distribution fast and easy > Join now and get one step closer to millions of Verizon customers > http://p.sf.net/sfu/verizon-dev2dev > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Jae-Joon Lee wrote: > On Sat, Jan 9, 2010 at 4:27 PM, Dominik Szczerba <do...@it...> wrote: >> When using white over back color scheme the legend() is unreadable, with >> apparently hard-coded white legend background - or is there a way to set >> it in the rc file? >> > > Unfortunately no. > I recommend you to manually change the color of the legend frame. > > l = plt.legend() > l.legendPatch.set_fc(plt.rcParams["axes.facecolor"]) > > I'm not very kin to introduce a new rc param for this. I think it is > good enough to have the legend background to follow the color of the > axes, as above. I'll try to commit the relevant change soon. > But any other suggestion will be welcomed. Hmmm, that property really deserves its own rc param, but if you do not like it, it should at least be somewhere automatically set to the current background color to be resistant against people like me ;) I would be happy to have such a fix... Thanks, Dominik > > Regards, > > -JJ > -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAktLfhwACgkQ/EBMh9bUuzKcTACglg3AmZ8PYFztHoQKeMTe+Elj KrcAnRi8FCAOpY9Pe96+0MQPyTZ7cnQ4 =MknU -----END PGP SIGNATURE-----
On Sat, Jan 9, 2010 at 4:27 PM, Dominik Szczerba <do...@it...> wrote: > When using white over back color scheme the legend() is unreadable, with > apparently hard-coded white legend background - or is there a way to set > it in the rc file? > Unfortunately no. I recommend you to manually change the color of the legend frame. l = plt.legend() l.legendPatch.set_fc(plt.rcParams["axes.facecolor"]) I'm not very kin to introduce a new rc param for this. I think it is good enough to have the legend background to follow the color of the axes, as above. I'll try to commit the relevant change soon. But any other suggestion will be welcomed. Regards, -JJ
First of all, to use "\color" with TeX, you need to use "color" package, i.e., you need to modify your latex preamble to include that package. This can be done by import matplotlib.pyplot as plt plt.rcParams["text.latex.preamble"] = r"\usepackage{color}" I guess the error you encounter is because of this (I'm not sure as the error message is slightly different in my machine). However, this WON'T work in general! The color information in the dvi (or png) file is ignored in most cases (the only exception I know is the ps backend which does not read in dvi of png output). So, if you only want ps output, you can use usetex with "\color" command. In matplotlib, a single Text object only have a single color associated. So changing the color of the text within the string is be hardly possible (except in the ps backend). So, I guess your best option is to call "text" (or "annotate") multiple times with different colors with fine-tuned text positions. FYI, It is possible to have two (or more) text instances of different colors packed together (somewhat similar to this example http://matplotlib.sourceforge.net/plot_directive/users/plotting/examples/anchored_box04.hires.png), Regards, -JJ On Mon, Jan 11, 2010 at 11:13 AM, Gökhan Sever <gok...@gm...> wrote: > This seems like the solution. However when I try: > > I[1]: plt.plot(range(10)) > I[2]: plt.ylabel(r"{\color{red} a red text}") > > It doesn't function and produce an ugly set of error messages: > > I[3]: ERROR: An unexpected error occurred while tokenizing input > The following traceback may be corrupted or invalid > The error message is: ('EOF in multi-line statement', (573, 0)) > > ERROR: An unexpected error occurred while tokenizing input > The following traceback may be corrupted or invalid > The error message is: ('EOF in multi-line statement', (573, 0)) > > ERROR: An unexpected error occurred while tokenizing input > The following traceback may be corrupted or invalid > The error message is: ('EOF in multi-line statement', (573, 0)) > > ERROR: An unexpected error occurred while tokenizing input > The following traceback may be corrupted or invalid > The error message is: ('EOF in multi-line statement', (573, 0)) > > ERROR: An unexpected error occurred while tokenizing input > The following traceback may be corrupted or invalid > The error message is: ('EOF in multi-line statement', (566, 0)) > > --------------------------------------------------------------------------- > RuntimeError Traceback (most recent call last) > > /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/backends/backend_qt4.pyc > in resizeEvent(self, event) > 167 hinch = h/dpival > 168 self.figure.set_size_inches( winch, hinch ) > --> 169 self.draw() > 170 self.update() > 171 QtGui.QWidget.resizeEvent(self, event) > > /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/backends/backend_qt4agg.pyc > in draw(self) > 128 if DEBUG: print "FigureCanvasQtAgg.draw", self > 129 self.replot = True > --> 130 FigureCanvasAgg.draw(self) > 131 self.update() > 132 > > /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/backends/backend_agg.pyc > in draw(self) > 386 > 387 self.renderer = self.get_renderer() > --> 388 self.figure.draw(self.renderer) > 389 > 390 def get_renderer(self): > > /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/artist.pyc in > draw_wrapper(artist, renderer, *kl) > 53 def draw_wrapper(artist, renderer, *kl): > 54 before(artist, renderer) > ---> 55 draw(artist, renderer, *kl) > 56 after(artist, renderer) > 57 > > /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/figure.pyc in > draw(self, renderer) > 800 dsu.sort(key=itemgetter(0)) > 801 for zorder, func, args in dsu: > --> 802 func(*args) > 803 > 804 renderer.close_group('figure') > > /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/artist.pyc in > draw_wrapper(artist, renderer, *kl) > 53 def draw_wrapper(artist, renderer, *kl): > 54 before(artist, renderer) > ---> 55 draw(artist, renderer, *kl) > 56 after(artist, renderer) > 57 > > /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/axes.pyc in > draw(self, renderer, inframe) > 1755 > 1756 for zorder, a in dsu: > -> 1757 a.draw(renderer) > 1758 > 1759 renderer.close_group('axes') > > /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/artist.pyc in > draw_wrapper(artist, renderer, *kl) > 53 def draw_wrapper(artist, renderer, *kl): > 54 before(artist, renderer) > ---> 55 draw(artist, renderer, *kl) > 56 after(artist, renderer) > 57 > > /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/axis.pyc in > draw(self, renderer, *args, **kwargs) > 819 self._update_label_position(ticklabelBoxes, ticklabelBoxes2) > 820 > --> 821 self.label.draw(renderer) > 822 > 823 self._update_offset_text_position(ticklabelBoxes, > ticklabelBoxes2) > > /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/artist.pyc in > draw_wrapper(artist, renderer, *kl) > 53 def draw_wrapper(artist, renderer, *kl): > 54 before(artist, renderer) > ---> 55 draw(artist, renderer, *kl) > 56 after(artist, renderer) > 57 > > /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/text.pyc in > draw(self, renderer) > 547 renderer.open_group('text', self.get_gid()) > 548 > --> 549 bbox, info = self._get_layout(renderer) > 550 trans = self.get_transform() > 551 > > /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/text.pyc in > _get_layout(self, renderer) > 303 w, h, d = get_text_width_height_descent(clean_line, > 304 > self._fontproperties, > --> 305 ismath=ismath) > 306 if baseline is None: > 307 baseline = h - d > > /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/backends/backend_agg.pyc > in get_text_width_height_descent(self, s, prop, ismath) > 169 fontsize = prop.get_size_in_points() > 170 w, h, d = texmanager.get_text_width_height_descent(s, > fontsize, > --> 171 > renderer=self) > 172 return w, h, d > 173 > > /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/texmanager.pyc in > get_text_width_height_descent(self, tex, fontsize, renderer) > 599 else: > 600 # use dviread. It sometimes returns a wrong descent. > > --> 601 dvifile = self.make_dvi(tex, fontsize) > 602 dvi = dviread.Dvi(dvifile, 72*dpi_fraction) > 603 page = iter(dvi).next() > > /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/texmanager.pyc in > make_dvi(self, tex, fontsize) > 369 if exit_status or not exists: > 370 raise RuntimeError(('LaTeX was not able to process > the following \ > --> 371 string:\n%s\nHere is the full report generated by LaTeX: \n\n'% > repr(tex)) + report) > 372 else: mpl.verbose.report(report, 'debug') > 373 for fname in glob.glob(basefile+'*'): > > RuntimeError: LaTeX was not able to process the following string: > '{\\color{red} a red text}' > Here is the full report generated by LaTeX: > > This is pdfTeXk, Version 3.141592-1.40.3 (Web2C 7.5.6) > %&-line parsing enabled. > entering extended mode > (./f5e3ddba2ab4bf5147d4e32e96deb043.tex > LaTeX2e <2005年12月01日> > Babel <v3.8h> and hyphenation patterns for english, usenglishmax, dumylang, > noh > yphenation, arabic, basque, bulgarian, coptic, welsh, czech, slovak, german, > ng > erman, danish, esperanto, spanish, catalan, galician, estonian, farsi, > finnish, > french, greek, monogreek, ancientgreek, croatian, hungarian, interlingua, > ibyc > us, indonesian, icelandic, italian, latin, mongolian, dutch, norsk, polish, > por > tuguese, pinyin, romanian, russian, slovenian, uppersorbian, serbian, > swedish, > turkish, ukenglish, ukrainian, loaded. > (/usr/share/texmf/tex/latex/base/article.cls > Document Class: article 2005年09月16日 v1.4f Standard LaTeX document class > (/usr/share/texmf/tex/latex/base/size10.clo)) > (/usr/share/texmf/tex/latex/type1cm/type1cm.sty) > (/usr/share/texmf/tex/latex/psnfss/helvet.sty > (/usr/share/texmf/tex/latex/graphics/keyval.sty)) > (/usr/share/texmf/tex/latex/psnfss/courier.sty) > (/usr/share/texmf/tex/latex/base/textcomp.sty > (/usr/share/texmf/tex/latex/base/ts1enc.def)) > (/usr/share/texmf/tex/latex/geometry/geometry.sty > > Package geometry Warning: Over-specification in `h'-direction. > `width' (5058.9pt) is ignored. > > > Package geometry Warning: Over-specification in `v'-direction. > `height' (5058.9pt) is ignored. > > ) > No file f5e3ddba2ab4bf5147d4e32e96deb043.aux. > (/usr/share/texmf/tex/latex/base/ts1cmr.fd) > (/usr/share/texmf/tex/latex/psnfss/ot1pnc.fd) > (/usr/share/texmf/tex/latex/psnfss/ot1phv.fd) > ! Undefined control sequence. > l.12 ...ze{12.000000}{15.000000}{\sffamily {\color > {red} a red text}} > [1] (./f5e3ddba2ab4bf5147d4e32e96deb043.aux) ) > (see the transcript file for additional information) > Output written on f5e3ddba2ab4bf5147d4e32e96deb043.dvi (1 page, 224 bytes). > Transcript written on f5e3ddba2ab4bf5147d4e32e96deb043.log. > > > Interestingly tex_demo.py works fine and renders the text properly onto the > figure. > > > On Mon, Jan 11, 2010 at 4:36 AM, Damon McDougall <D.M...@wa...> > wrote: >> >> Hi Gökhan, >> Do you have usetex=True set? If so, have you tried the LaTeX command >> sequence \color{red}{Red text goes here} ? >> Regards, >> -- Damon >> >> -------------------------- >> Damon McDougall >> Mathematics Institute >> University of Warwick >> Coventry >> CV4 7AL >> d.m...@wa... >> On 11 Jan 2010, at 05:48, Gökhan Sever wrote: >> >> Hello, >> >> Is there a way to color words differently in a label or title, for >> example: >> >> ylabel("measurement 1 (in red color)" , "measurement 2 (in blue color)") >> to match with the plotted line colors? >> >> Thanks. >> >> -- >> Gökhan >> >> ------------------------------------------------------------------------------ >> This SF.Net email is sponsored by the Verizon Developer Community >> Take advantage of Verizon's best-in-class app development support >> A streamlined, 14 day to market process makes app distribution fast and >> easy >> Join now and get one step closer to millions of Verizon customers >> http://p.sf.net/sfu/verizon-dev2dev >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> > > > > -- > Gökhan > > ------------------------------------------------------------------------------ > This SF.Net email is sponsored by the Verizon Developer Community > Take advantage of Verizon's best-in-class app development support > A streamlined, 14 day to market process makes app distribution fast and easy > Join now and get one step closer to millions of Verizon customers > http://p.sf.net/sfu/verizon-dev2dev > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > >
See this example http://matplotlib.sourceforge.net/examples/pylab_examples/scatter_hist.html Or, you're willing to learn something new, you may use axes_grid toolkit. http://matplotlib.sourceforge.net/examples/axes_grid/scatter_hist.html -JJ
You code works okay with the current svn. See if changing the distiller option makes any difference ("ps.usedistiller" in the rc file). The best would be for you to upgrade to the recent release of matplotlib if possible. Regards, -JJ On Mon, Jan 11, 2010 at 8:35 AM, John Reid <j....@ma...> wrote: > Hi, > > I'm using matplotlib 0.98.5.2 on Ubuntu with Ghostscript 8.70. The > following code produces the following error. Can anyone verify whether > this a problem with my installation or with matplotlib? > > import pylab as P > P.figure() > width=.4 > x1 = [-0.4, 0.6, 1.6, 2.6, 3.6, 4.6, 5.6] > y1 = [1.0, 0.96875, 0.77584381616639686, 0.54678532728659146, > 0.4043846450263317, 0.28361561411668612, 1.0] > x2 = [0, 1, 2, 3, 4, 5, 6] > y2 = [1.0, 0.97032301818547173, 0.77110383361936519, > 0.54221305796207875, 0.40019201884735922, 0.28326596333427007, 1.0] > P.bar(x1, y1, color='blue' , width=width, label='nodes') > P.bar(x2, y2, color='green', width=width, label='occurrences') > P.savefig('fraction-evaluated.eps') > P.close() > > > > > /home/john/Dev/MyProjects/Bio/MotifSearch/python/stem.py in <module>() > 246 P.bar(x1, y1, color='blue' , width=width, label='nodes') > 247 P.bar(x2, y2, color='green', width=width, label='occurrences') > --> 248 P.savefig('fraction-evaluated.eps') > 249 P.close() > 250 raise > > /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/pyplot.pyc > in savefig(*args, **kwargs) > 343 def savefig(*args, **kwargs): > 344 fig = gcf() > --> 345 return fig.savefig(*args, **kwargs) > 346 if Figure.savefig.__doc__ is not None: > 347 savefig.__doc__ = dedent(Figure.savefig.__doc__) > > /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/figure.pyc > in savefig(self, *args, **kwargs) > 988 patch.set_alpha(0.0) > 989 > --> 990 self.canvas.print_figure(*args, **kwargs) > 991 > 992 if transparent: > > /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_wxagg.pyc > in print_figure(self, filename, *args, **kwargs) > 99 def print_figure(self, filename, *args, **kwargs): > 100 # Use pure Agg renderer to draw > --> 101 FigureCanvasAgg.print_figure(self, filename, *args, > **kwargs) > 102 # Restore the current view; this is needed because the > 103 # artist contains methods rely on particular attributes > > /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backend_bases.pyc > in print_figure(self, filename, dpi, facecolor, edgecolor, orientation, > format, **kwargs) > 1417 edgecolor=edgecolor, > 1418 orientation=orientation, > -> 1419 **kwargs) > 1420 finally: > 1421 self.figure.dpi = origDPI > > /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backend_bases.pyc > in print_eps(self, *args, **kwargs) > 1306 from backends.backend_ps import FigureCanvasPS # lazy > import > 1307 ps = self.switch_backends(FigureCanvasPS) > -> 1308 return ps.print_eps(*args, **kwargs) > 1309 > 1310 def print_pdf(self, *args, **kwargs): > > /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc > in print_eps(self, outfile, *args, **kwargs) > 867 > 868 def print_eps(self, outfile, *args, **kwargs): > --> 869 return self._print_ps(outfile, 'eps', *args, **kwargs) > 870 > 871 def _print_ps(self, outfile, format, *args, **kwargs): > > /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc > in _print_ps(self, outfile, format, *args, **kwargs) > 893 else: > 894 self._print_figure(outfile, format, imagedpi, > facecolor, edgecolor, > --> 895 orientation, isLandscape, papertype) > 896 > 897 def _print_figure(self, outfile, format, dpi=72, > facecolor='w', edgecolor='w', > > /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc > in _print_figure(self, outfile, format, dpi, facecolor, edgecolor, > orientation, isLandscape, papertype) > 1036 gs_distill(tmpfile, isEPSF, ptype=papertype, bbox=bbox) > 1037 elif rcParams['ps.usedistiller'] == 'xpdf': > -> 1038 xpdf_distill(tmpfile, isEPSF, ptype=papertype, > bbox=bbox) > 1039 > 1040 if passed_in_file_object: > > /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc > in xpdf_distill(tmpfile, eps, ptype, bbox) > 1311 shutil.move(psfile, tmpfile) > 1312 if eps: > -> 1313 pstoeps(tmpfile, bbox) > 1314 for fname in glob.glob(tmpfile+'.*'): > 1315 os.remove(fname) > > /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc > in pstoeps(tmpfile, bbox) > 1362 Convert the postscript to encapsulated postscript. > 1363 """ > -> 1364 bbox_info = get_bbox(tmpfile, bbox) > 1365 > 1366 epsfile = tmpfile + '.eps' > > /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc > in get_bbox(tmpfile, bbox) > 1336 else: > 1337 raise RuntimeError('Ghostscript was not able to extract > a bounding box.\ > -> 1338 Here is the Ghostscript output:\n\n%s'% bbox_info) > 1339 l, b, r, t = [float(i) for i in bbox_info.split()[-4:]] > 1340 > > RuntimeError: Ghostscript was not able to extract a bounding box.Here is > the Ghostscript output: > > GPL Ghostscript 8.70: Unrecoverable error, exit code 1 > > > > /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.py(1338)get_bbox() > 1337 raise RuntimeError('Ghostscript was not able to extract > a bounding box.\ > -> 1338 Here is the Ghostscript output:\n\n%s'% bbox_info) > 1339 l, b, r, t = [float(i) for i in bbox_info.split()[-4:]] > > > ------------------------------------------------------------------------------ > This SF.Net email is sponsored by the Verizon Developer Community > Take advantage of Verizon's best-in-class app development support > A streamlined, 14 day to market process makes app distribution fast and easy > Join now and get one step closer to millions of Verizon customers > http://p.sf.net/sfu/verizon-dev2dev > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users >
This seems like the solution. However when I try: I[1]: plt.plot(range(10)) I[2]: plt.ylabel(r"{\color{red} a red text}") It doesn't function and produce an ugly set of error messages: I[3]: ERROR: An unexpected error occurred while tokenizing input The following traceback may be corrupted or invalid The error message is: ('EOF in multi-line statement', (573, 0)) ERROR: An unexpected error occurred while tokenizing input The following traceback may be corrupted or invalid The error message is: ('EOF in multi-line statement', (573, 0)) ERROR: An unexpected error occurred while tokenizing input The following traceback may be corrupted or invalid The error message is: ('EOF in multi-line statement', (573, 0)) ERROR: An unexpected error occurred while tokenizing input The following traceback may be corrupted or invalid The error message is: ('EOF in multi-line statement', (573, 0)) ERROR: An unexpected error occurred while tokenizing input The following traceback may be corrupted or invalid The error message is: ('EOF in multi-line statement', (566, 0)) --------------------------------------------------------------------------- RuntimeError Traceback (most recent call last) /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/backends/backend_qt4.pyc in resizeEvent(self, event) 167 hinch = h/dpival 168 self.figure.set_size_inches( winch, hinch ) --> 169 self.draw() 170 self.update() 171 QtGui.QWidget.resizeEvent(self, event) /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/backends/backend_qt4agg.pyc in draw(self) 128 if DEBUG: print "FigureCanvasQtAgg.draw", self 129 self.replot = True --> 130 FigureCanvasAgg.draw(self) 131 self.update() 132 /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/backends/backend_agg.pyc in draw(self) 386 387 self.renderer = self.get_renderer() --> 388 self.figure.draw(self.renderer) 389 390 def get_renderer(self): /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/artist.pyc in draw_wrapper(artist, renderer, *kl) 53 def draw_wrapper(artist, renderer, *kl): 54 before(artist, renderer) ---> 55 draw(artist, renderer, *kl) 56 after(artist, renderer) 57 /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/figure.pyc in draw(self, renderer) 800 dsu.sort(key=itemgetter(0)) 801 for zorder, func, args in dsu: --> 802 func(*args) 803 804 renderer.close_group('figure') /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/artist.pyc in draw_wrapper(artist, renderer, *kl) 53 def draw_wrapper(artist, renderer, *kl): 54 before(artist, renderer) ---> 55 draw(artist, renderer, *kl) 56 after(artist, renderer) 57 /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/axes.pyc in draw(self, renderer, inframe) 1755 1756 for zorder, a in dsu: -> 1757 a.draw(renderer) 1758 1759 renderer.close_group('axes') /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/artist.pyc in draw_wrapper(artist, renderer, *kl) 53 def draw_wrapper(artist, renderer, *kl): 54 before(artist, renderer) ---> 55 draw(artist, renderer, *kl) 56 after(artist, renderer) 57 /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/axis.pyc in draw(self, renderer, *args, **kwargs) 819 self._update_label_position(ticklabelBoxes, ticklabelBoxes2) 820 --> 821 self.label.draw(renderer) 822 823 self._update_offset_text_position(ticklabelBoxes, ticklabelBoxes2) /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/artist.pyc in draw_wrapper(artist, renderer, *kl) 53 def draw_wrapper(artist, renderer, *kl): 54 before(artist, renderer) ---> 55 draw(artist, renderer, *kl) 56 after(artist, renderer) 57 /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/text.pyc in draw(self, renderer) 547 renderer.open_group('text', self.get_gid()) 548 --> 549 bbox, info = self._get_layout(renderer) 550 trans = self.get_transform() 551 /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/text.pyc in _get_layout(self, renderer) 303 w, h, d = get_text_width_height_descent(clean_line, 304 self._fontproperties, --> 305 ismath=ismath) 306 if baseline is None: 307 baseline = h - d /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/backends/backend_agg.pyc in get_text_width_height_descent(self, s, prop, ismath) 169 fontsize = prop.get_size_in_points() 170 w, h, d = texmanager.get_text_width_height_descent(s, fontsize, --> 171 renderer=self) 172 return w, h, d 173 /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/texmanager.pyc in get_text_width_height_descent(self, tex, fontsize, renderer) 599 else: 600 # use dviread. It sometimes returns a wrong descent. --> 601 dvifile = self.make_dvi(tex, fontsize) 602 dvi = dviread.Dvi(dvifile, 72*dpi_fraction) 603 page = iter(dvi).next() /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/texmanager.pyc in make_dvi(self, tex, fontsize) 369 if exit_status or not exists: 370 raise RuntimeError(('LaTeX was not able to process the following \ --> 371 string:\n%s\nHere is the full report generated by LaTeX: \n\n'% repr(tex)) + report) 372 else: mpl.verbose.report(report, 'debug') 373 for fname in glob.glob(basefile+'*'): RuntimeError: LaTeX was not able to process the following string: '{\\color{red} a red text}' Here is the full report generated by LaTeX: This is pdfTeXk, Version 3.141592-1.40.3 (Web2C 7.5.6) %&-line parsing enabled. entering extended mode (./f5e3ddba2ab4bf5147d4e32e96deb043.tex LaTeX2e <2005年12月01日> Babel <v3.8h> and hyphenation patterns for english, usenglishmax, dumylang, noh yphenation, arabic, basque, bulgarian, coptic, welsh, czech, slovak, german, ng erman, danish, esperanto, spanish, catalan, galician, estonian, farsi, finnish, french, greek, monogreek, ancientgreek, croatian, hungarian, interlingua, ibyc us, indonesian, icelandic, italian, latin, mongolian, dutch, norsk, polish, por tuguese, pinyin, romanian, russian, slovenian, uppersorbian, serbian, swedish, turkish, ukenglish, ukrainian, loaded. (/usr/share/texmf/tex/latex/base/article.cls Document Class: article 2005年09月16日 v1.4f Standard LaTeX document class (/usr/share/texmf/tex/latex/base/size10.clo)) (/usr/share/texmf/tex/latex/type1cm/type1cm.sty) (/usr/share/texmf/tex/latex/psnfss/helvet.sty (/usr/share/texmf/tex/latex/graphics/keyval.sty)) (/usr/share/texmf/tex/latex/psnfss/courier.sty) (/usr/share/texmf/tex/latex/base/textcomp.sty (/usr/share/texmf/tex/latex/base/ts1enc.def)) (/usr/share/texmf/tex/latex/geometry/geometry.sty Package geometry Warning: Over-specification in `h'-direction. `width' (5058.9pt) is ignored. Package geometry Warning: Over-specification in `v'-direction. `height' (5058.9pt) is ignored. ) No file f5e3ddba2ab4bf5147d4e32e96deb043.aux. (/usr/share/texmf/tex/latex/base/ts1cmr.fd) (/usr/share/texmf/tex/latex/psnfss/ot1pnc.fd) (/usr/share/texmf/tex/latex/psnfss/ot1phv.fd) ! Undefined control sequence. l.12 ...ze{12.000000}{15.000000}{\sffamily {\color {red} a red text}} [1] (./f5e3ddba2ab4bf5147d4e32e96deb043.aux) ) (see the transcript file for additional information) Output written on f5e3ddba2ab4bf5147d4e32e96deb043.dvi (1 page, 224 bytes). Transcript written on f5e3ddba2ab4bf5147d4e32e96deb043.log. Interestingly tex_demo.py works fine and renders the text properly onto the figure. On Mon, Jan 11, 2010 at 4:36 AM, Damon McDougall <D.M...@wa...>wrote: > Hi Gökhan, > > Do you have usetex=True set? If so, have you tried the LaTeX command > sequence \color{red}{Red text goes here} ? > > Regards, > -- Damon > > -------------------------- > Damon McDougall > Mathematics Institute > University of Warwick > Coventry > CV4 7AL > d.m...@wa... > > On 11 Jan 2010, at 05:48, Gökhan Sever wrote: > > Hello, > > Is there a way to color words differently in a label or title, for example: > > ylabel("measurement 1 (in red color)" , "measurement 2 (in blue color)") > to match with the plotted line colors? > > Thanks. > > -- > Gökhan > > ------------------------------------------------------------------------------ > This SF.Net email is sponsored by the Verizon Developer Community > Take advantage of Verizon's best-in-class app development support > A streamlined, 14 day to market process makes app distribution fast and > easy > Join now and get one step closer to millions of Verizon customers > http://p.sf.net/sfu/verizon-dev2dev_______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > -- Gökhan
Gökhan Sever wrote: > > > On Mon, Jan 11, 2010 at 6:51 AM, Jeff Whitaker <js...@fa... > <mailto:js...@fa...>> wrote: > > Gökhan Sever wrote: > > Hello, > > Is there a way to color words differently in a label or title, > for example: > > ylabel("measurement 1 (in red color)" , "measurement 2 (in > blue color)") to match with the plotted line colors? > > Thanks. > > -- > Gökhan > > Gökhan: > > ylabel('measurement 1',color='r') > ylabel('measurement 2',color='b') > > > -Jeff > > > In this fashion the second call replaces the first text. What I want > is two words next to each other and in different colors. > > -- > Gökhan Gökhan: Then I think you'll have to go with the TeX solution (i..e \color{red}{Red text goes here} \color{blue}{Blue text goes here}). - Jeff -- Jeffrey S. Whitaker Phone : (303)497-6313 Meteorologist FAX : (303)497-6449 NOAA/OAR/PSD R/PSD1 Email : Jef...@no... 325 Broadway Office : Skaggs Research Cntr 1D-113 Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg
I wanted to display my figure legend below my figure in the second row, so I used subplot(211) to create two rows. However, this creates two rows of equal height, so my graph is crammed into half the figure height in the first row, while my tiny legend barely fills up any of the second row. How do you specify relative heights of each row? For example, I'd like to specify the first row takes 80% of the figure height, while the second takes 20%. I've searched the docs, but I can't find anything. Is this possible? Regards, Chris
Hi, I'm using matplotlib 0.98.5.2 on Ubuntu with Ghostscript 8.70. The following code produces the following error. Can anyone verify whether this a problem with my installation or with matplotlib? import pylab as P P.figure() width=.4 x1 = [-0.4, 0.6, 1.6, 2.6, 3.6, 4.6, 5.6] y1 = [1.0, 0.96875, 0.77584381616639686, 0.54678532728659146, 0.4043846450263317, 0.28361561411668612, 1.0] x2 = [0, 1, 2, 3, 4, 5, 6] y2 = [1.0, 0.97032301818547173, 0.77110383361936519, 0.54221305796207875, 0.40019201884735922, 0.28326596333427007, 1.0] P.bar(x1, y1, color='blue' , width=width, label='nodes') P.bar(x2, y2, color='green', width=width, label='occurrences') P.savefig('fraction-evaluated.eps') P.close() /home/john/Dev/MyProjects/Bio/MotifSearch/python/stem.py in <module>() 246 P.bar(x1, y1, color='blue' , width=width, label='nodes') 247 P.bar(x2, y2, color='green', width=width, label='occurrences') --> 248 P.savefig('fraction-evaluated.eps') 249 P.close() 250 raise /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/pyplot.pyc in savefig(*args, **kwargs) 343 def savefig(*args, **kwargs): 344 fig = gcf() --> 345 return fig.savefig(*args, **kwargs) 346 if Figure.savefig.__doc__ is not None: 347 savefig.__doc__ = dedent(Figure.savefig.__doc__) /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/figure.pyc in savefig(self, *args, **kwargs) 988 patch.set_alpha(0.0) 989 --> 990 self.canvas.print_figure(*args, **kwargs) 991 992 if transparent: /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_wxagg.pyc in print_figure(self, filename, *args, **kwargs) 99 def print_figure(self, filename, *args, **kwargs): 100 # Use pure Agg renderer to draw --> 101 FigureCanvasAgg.print_figure(self, filename, *args, **kwargs) 102 # Restore the current view; this is needed because the 103 # artist contains methods rely on particular attributes /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backend_bases.pyc in print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, **kwargs) 1417 edgecolor=edgecolor, 1418 orientation=orientation, -> 1419 **kwargs) 1420 finally: 1421 self.figure.dpi = origDPI /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backend_bases.pyc in print_eps(self, *args, **kwargs) 1306 from backends.backend_ps import FigureCanvasPS # lazy import 1307 ps = self.switch_backends(FigureCanvasPS) -> 1308 return ps.print_eps(*args, **kwargs) 1309 1310 def print_pdf(self, *args, **kwargs): /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc in print_eps(self, outfile, *args, **kwargs) 867 868 def print_eps(self, outfile, *args, **kwargs): --> 869 return self._print_ps(outfile, 'eps', *args, **kwargs) 870 871 def _print_ps(self, outfile, format, *args, **kwargs): /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc in _print_ps(self, outfile, format, *args, **kwargs) 893 else: 894 self._print_figure(outfile, format, imagedpi, facecolor, edgecolor, --> 895 orientation, isLandscape, papertype) 896 897 def _print_figure(self, outfile, format, dpi=72, facecolor='w', edgecolor='w', /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc in _print_figure(self, outfile, format, dpi, facecolor, edgecolor, orientation, isLandscape, papertype) 1036 gs_distill(tmpfile, isEPSF, ptype=papertype, bbox=bbox) 1037 elif rcParams['ps.usedistiller'] == 'xpdf': -> 1038 xpdf_distill(tmpfile, isEPSF, ptype=papertype, bbox=bbox) 1039 1040 if passed_in_file_object: /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc in xpdf_distill(tmpfile, eps, ptype, bbox) 1311 shutil.move(psfile, tmpfile) 1312 if eps: -> 1313 pstoeps(tmpfile, bbox) 1314 for fname in glob.glob(tmpfile+'.*'): 1315 os.remove(fname) /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc in pstoeps(tmpfile, bbox) 1362 Convert the postscript to encapsulated postscript. 1363 """ -> 1364 bbox_info = get_bbox(tmpfile, bbox) 1365 1366 epsfile = tmpfile + '.eps' /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc in get_bbox(tmpfile, bbox) 1336 else: 1337 raise RuntimeError('Ghostscript was not able to extract a bounding box.\ -> 1338 Here is the Ghostscript output:\n\n%s'% bbox_info) 1339 l, b, r, t = [float(i) for i in bbox_info.split()[-4:]] 1340 RuntimeError: Ghostscript was not able to extract a bounding box.Here is the Ghostscript output: GPL Ghostscript 8.70: Unrecoverable error, exit code 1 > /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.py(1338)get_bbox() 1337 raise RuntimeError('Ghostscript was not able to extract a bounding box.\ -> 1338 Here is the Ghostscript output:\n\n%s'% bbox_info) 1339 l, b, r, t = [float(i) for i in bbox_info.split()[-4:]]
Gökhan Sever wrote: > Hello, > > Is there a way to color words differently in a label or title, for > example: > > ylabel("measurement 1 (in red color)" , "measurement 2 (in blue > color)") to match with the plotted line colors? > > Thanks. > > -- > Gökhan Gökhan: ylabel('measurement 1',color='r') ylabel('measurement 2',color='b') -Jeff
Hi Gökhan, Do you have usetex=True set? If so, have you tried the LaTeX command sequence \color{red}{Red text goes here} ? Regards, -- Damon -------------------------- Damon McDougall Mathematics Institute University of Warwick Coventry CV4 7AL d.m...@wa... On 11 Jan 2010, at 05:48, Gökhan Sever wrote: > Hello, > > Is there a way to color words differently in a label or title, for example: > > ylabel("measurement 1 (in red color)" , "measurement 2 (in blue color)") to match with the plotted line colors? > > Thanks. > > -- > Gökhan > ------------------------------------------------------------------------------ > This SF.Net email is sponsored by the Verizon Developer Community > Take advantage of Verizon's best-in-class app development support > A streamlined, 14 day to market process makes app distribution fast and easy > Join now and get one step closer to millions of Verizon customers > http://p.sf.net/sfu/verizon-dev2dev _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Hello, Is there a way to color words differently in a label or title, for example: ylabel("measurement 1 (in red color)" , "measurement 2 (in blue color)") to match with the plotted line colors? Thanks. -- Gökhan