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}
(151) 
_{Aug}

_{Sep}

_{Oct}

_{Nov}

_{Dec}

S  M  T  W  T  F  S 







1

2
(2) 
3
(16) 
4
(22) 
5
(7) 
6

7
(9) 
8
(2) 
9

10
(7) 
11
(15) 
12
(7) 
13
(4) 
14
(7) 
15
(3) 
16
(6) 
17
(20) 
18
(18) 
19
(15) 
20
(27) 
21
(14) 
22

23
(1) 
24
(18) 
25
(22) 
26
(36) 
27
(17) 
28
(6) 
29
(2) 
30
(3) 
31
(6) 





From: Eian Vizzini <e.j.v@sb...>  20100520 22:59:58

Hi, I would like a copy of matplotlib that is compatible with python 2.3. I searched all over the net and it is really difficult to find anything. Does anyone still have a copy? I believe it's version 0.87.3 or before. Thank you, Eian 
From: João Luís Silva <jsilva@fc...>  20100520 22:32:51

JaeJoon Lee wrote: > I cannot reproduce this error. > I'm using r8330 on Linux. > > I guess the error does not occur when you use a normal subplot? > > Just in case, replace axes_grid with axes_grid1 and see if it makes > any difference, i.e., > > from mpl_toolkits.axes_grid1.parasite_axes import SubplotHost > > Regards, > > JJ > I've tried axes_grid1 and it works well. I'm using the default latex (Ubuntu 9.10) latex version pdfTeX using libpoppler 3.1415921.40.32.2 (Web2C 7.5.6) [etc.] Both the patches presented fixed the problem, thanks. João Silva 
From: JaeJoon Lee <lee.j.joon@gm...>  20100520 19:34:21

On Mon, May 10, 2010 at 12:19 PM, Nico Schlömer <nico.schloemer@...> wrote: > When tick labels are explicitly supplied, that may not actually > reflect in the return result of get_ticks. Specifically, I set the > tick labels in a color bar, but get_ticklabels() returns a list of > empty text objects Text(0,0,''). > For regular axes, that seems to work better. > How did you set your ticklabels? Again, matplotlib does not guarantee that all ticks that are returned by get_ticks() will be actually drawn. On other words, get_ticks may return ticks that are meaningless (and this is not a bug). Also, colorbar axes works slightly differently from normal axes, but I'm not sure if this is related with your problem. As far as I can say, the use of get_ticks(), get_ticklabels() and etc method should be limited to when you want to view/change their artist attributes (like colors, etc.). You should not rely on this to determine things like, whether some ticks will be drawn, locations of ticks, and etc. JJ 
From: JaeJoon Lee <lee.j.joon@gm...>  20100520 19:19:12

On Thu, May 20, 2010 at 3:17 PM, JaeJoon Lee <lee.j.joon@...> wrote: > Again, note that not all ticks that are returned by get_xticks() > methods may be actually drawn. > I mean, even if their tick1On (and others) is True. JJ 
From: JaeJoon Lee <lee.j.joon@gm...>  20100520 19:17:39

Like the gridlines, these are determined during the drawing time. Each tick instances have tick1On tick2On label1On label2On attributes that controls whether to draw tick (or ticklabel) or not. Again, note that not all ticks that are returned by get_xticks() methods may be actually drawn. JJ On Sat, May 8, 2010 at 4:36 AM, Nico Schlömer <nico.schloemer@...> wrote: > Hi, > > say, is there a way to query an axis object whether or not the tick > labels are drawn? > > I looked at  one the xaxis  get_xticks( and get_xticklabels() > which in two different situations would spit out a list of doubles > (the tick positions) and a list of text entries of the form > Text(0,0,''). In one plot, though, the tick labels are drawn, not in > the other one. > > Cheers, > Nico > >  > > _______________________________________________ > Matplotlibusers mailing list > Matplotlibusers@... > https://lists.sourceforge.net/lists/listinfo/matplotlibusers > 
From: JaeJoon Lee <lee.j.joon@gm...>  20100520 19:05:30

On Thu, May 13, 2010 at 11:25 PM, Uri Laserson <laserson@...> wrote: > I noticed that the example for the radar chart has only a single scale. Is > there a way to generate a radar plot where each axis has its own scale? Can you show us some example plots? I'm not clear what you want. Regards, JJ 
From: JaeJoon Lee <lee.j.joon@gm...>  20100520 19:01:26

It turns out that when axes_grid toolkit is used and there are some ticks does not have associated ticklabels (i.e., minor ticks), it tries to call the "get_texts_widths_heights_descents" method with empty string. The following patch prevent this.  a/lib/mpl_toolkits/axisartist/axis_artist.py +++ b/lib/mpl_toolkits/axisartist/axis_artist.py @@ 769,6 +769,7 @@ class TickLabels(AxisLabel, AttributeCopier): # mtext.Text #self._set_offset_radius(r) for (x, y), a, l in self._locs_angles_labels: + if not l.strip(): continue self._set_ref_angle(a) #+ add_angle self.set_x(x) self.set_y(y) @@ 811,6 +812,7 @@ class TickLabels(AxisLabel, AttributeCopier): # mtext.Text """ whd_list = [] for (x, y), a, l in self._locs_angles_labels: + if not l.strip(): continue clean_line, ismath = self.is_math_text(l) whd = renderer.get_text_width_height_descent( clean_line, self._fontproperties, ismath=ismath) But it may be still safer to return 0,0,0 when empty string is given for *get_texts_widths_heights_descents*? Regards, JJ On Thu, May 20, 2010 at 2:36 PM, Michael Droettboom <mdroe@...> wrote: > The following patch avoids the error with your attached plot. I'm sure > if it the right fix though  I'm not sure why empty strings are being > sent this far along, and I'm also not seeing any ticks along the top. > > Mike > > Index: lib/matplotlib/texmanager.py > =================================================================== >  lib/matplotlib/texmanager.py (revision 8329) > +++ lib/matplotlib/texmanager.py (working copy) > @@ 578,6 +578,9 @@ > return width, heigth and descent of the text. > """ > > + if tex.strip() == '': > + return 0, 0, 0 > + > if renderer: > dpi_fraction = renderer.points_to_pixels(1.) > else: > > > On 05/20/2010 02:11 PM, João Luís Silva wrote: >> from matplotlib import rc >> rc('text', usetex=True) >> >> from mpl_toolkits.axes_grid.parasite_axes import SubplotHost >> import numpy as np >> import matplotlib.pyplot as plt >> >> fig = plt.figure(1) >> ax = SubplotHost(fig, 111) >> fig.add_subplot(ax) >> x = np.arange(1.0,10.0,0.1) >> ax.semilogy(x,x**2) >> plt.show() >> > > >  > Michael Droettboom > Science Software Branch > Space Telescope Science Institute > Baltimore, Maryland, USA > > >  > > _______________________________________________ > Matplotlibusers mailing list > Matplotlibusers@... > https://lists.sourceforge.net/lists/listinfo/matplotlibusers > 
From: JaeJoon Lee <lee.j.joon@gm...>  20100520 18:39:19

http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.plot use *markevery* keyword. http://matplotlib.sourceforge.net/api/artist_api.html#matplotlib.lines.Line2D.set_markevery If you want more control, you can always draws the lines (without markers) first and overplot markers in positions you want separately. Regards, JJ On Wed, May 19, 2010 at 11:56 AM, Omer Khalid <Omer.Khalid@...> wrote: > Hi, > I am a wondering if it's possible to have few line distinguishing marks on > the data lines on a chart such as circle, start, square. When I use some > thing like this for the color of the graph (i.e. rs, k^), it uses the shape > for each data point and the lines becomes very thick. All I want is to put > 45 shaper markers on each line with line (the data line will have few > hundred data points). > Many thanks, > Omer >  > > > _______________________________________________ > Matplotlibusers mailing list > Matplotlibusers@... > https://lists.sourceforge.net/lists/listinfo/matplotlibusers > > 
From: Michael Droettboom <mdroe@st...>  20100520 18:38:27

The error may be dependent on the version of latex being used. Yours may be handling the empty content just fine. (I'm using TexLive 2009 on RHEL5). Mike On 05/20/2010 02:34 PM, JaeJoon Lee wrote: > I cannot reproduce this error. > I'm using r8330 on Linux. > > I guess the error does not occur when you use a normal subplot? > > Just in case, replace axes_grid with axes_grid1 and see if it makes > any difference, i.e., > > from mpl_toolkits.axes_grid1.parasite_axes import SubplotHost > > Regards, > > JJ > > > On Thu, May 20, 2010 at 2:11 PM, João Luís Silva<jsilva@...> wrote: > >> Hi, >> >> I ran into a bug where I get the LaTeX error: >> >> RuntimeError: LaTeX was not able to process the following string: >> >> '' >> >> I know it's an uncommon plot, but I need extra (nonuniform) tick labels >> at the top so I'm using SubplotHost, on a semilog plot with usetex (so >> the fonts look similar to the ones on the paper). >> >> Matplotlib svn r8330 on Ubuntu 9.10. >> >> Regards, >> João Silva >> >> Example script:  >> >> from matplotlib import rc >> rc('text', usetex=True) >> >> from mpl_toolkits.axes_grid.parasite_axes import SubplotHost >> import numpy as np >> import matplotlib.pyplot as plt >> >> fig = plt.figure(1) >> ax = SubplotHost(fig, 111) >> fig.add_subplot(ax) >> x = np.arange(1.0,10.0,0.1) >> ax.semilogy(x,x**2) >> plt.show() >> >>  >> >> >>  >> >> _______________________________________________ >> Matplotlibusers mailing list >> Matplotlibusers@... >> https://lists.sourceforge.net/lists/listinfo/matplotlibusers >> >> >  > > _______________________________________________ > Matplotlibusers mailing list > Matplotlibusers@... > https://lists.sourceforge.net/lists/listinfo/matplotlibusers >  Michael Droettboom Science Software Branch Space Telescope Science Institute Baltimore, Maryland, USA 
From: Michael Droettboom <mdroe@st...>  20100520 18:36:26

The following patch avoids the error with your attached plot. I'm sure if it the right fix though  I'm not sure why empty strings are being sent this far along, and I'm also not seeing any ticks along the top. Mike Index: lib/matplotlib/texmanager.py ===================================================================  lib/matplotlib/texmanager.py (revision 8329) +++ lib/matplotlib/texmanager.py (working copy) @@ 578,6 +578,9 @@ return width, heigth and descent of the text. """ + if tex.strip() == '': + return 0, 0, 0 + if renderer: dpi_fraction = renderer.points_to_pixels(1.) else: On 05/20/2010 02:11 PM, João Luís Silva wrote: > from matplotlib import rc > rc('text', usetex=True) > > from mpl_toolkits.axes_grid.parasite_axes import SubplotHost > import numpy as np > import matplotlib.pyplot as plt > > fig = plt.figure(1) > ax = SubplotHost(fig, 111) > fig.add_subplot(ax) > x = np.arange(1.0,10.0,0.1) > ax.semilogy(x,x**2) > plt.show() >  Michael Droettboom Science Software Branch Space Telescope Science Institute Baltimore, Maryland, USA 
From: JaeJoon Lee <lee.j.joon@gm...>  20100520 18:35:17

I cannot reproduce this error. I'm using r8330 on Linux. I guess the error does not occur when you use a normal subplot? Just in case, replace axes_grid with axes_grid1 and see if it makes any difference, i.e., from mpl_toolkits.axes_grid1.parasite_axes import SubplotHost Regards, JJ On Thu, May 20, 2010 at 2:11 PM, João Luís Silva <jsilva@...> wrote: > Hi, > > I ran into a bug where I get the LaTeX error: > > RuntimeError: LaTeX was not able to process the following string: > > '' > > I know it's an uncommon plot, but I need extra (nonuniform) tick labels > at the top so I'm using SubplotHost, on a semilog plot with usetex (so > the fonts look similar to the ones on the paper). > > Matplotlib svn r8330 on Ubuntu 9.10. > > Regards, > João Silva > > Example script:  > > from matplotlib import rc > rc('text', usetex=True) > > from mpl_toolkits.axes_grid.parasite_axes import SubplotHost > import numpy as np > import matplotlib.pyplot as plt > > fig = plt.figure(1) > ax = SubplotHost(fig, 111) > fig.add_subplot(ax) > x = np.arange(1.0,10.0,0.1) > ax.semilogy(x,x**2) > plt.show() > >  > > >  > > _______________________________________________ > Matplotlibusers mailing list > Matplotlibusers@... > https://lists.sourceforge.net/lists/listinfo/matplotlibusers > 
From: João Luís Silva <jsilva@fc...>  20100520 18:11:47

Hi, I ran into a bug where I get the LaTeX error: RuntimeError: LaTeX was not able to process the following string: '' I know it's an uncommon plot, but I need extra (nonuniform) tick labels at the top so I'm using SubplotHost, on a semilog plot with usetex (so the fonts look similar to the ones on the paper). Matplotlib svn r8330 on Ubuntu 9.10. Regards, João Silva Example script:  from matplotlib import rc rc('text', usetex=True) from mpl_toolkits.axes_grid.parasite_axes import SubplotHost import numpy as np import matplotlib.pyplot as plt fig = plt.figure(1) ax = SubplotHost(fig, 111) fig.add_subplot(ax) x = np.arange(1.0,10.0,0.1) ax.semilogy(x,x**2) plt.show()  
From: Eric Firing <efiring@ha...>  20100520 17:41:47

On 05/19/2010 11:31 PM, Christer Malmberg wrote: > Thank you for the help, I never knew what the symlog flag did actually. > > However, there is still a slight problem: > > ===================================================== > x = array([0,1,2,4,6,9,12,24]) > y = array([1000000, 500000, 100000, 100, 5, 1, 1, 1]) > subplot(111) > plot(x, y) > yscale('symlog') > xscale=('linear') > ylim(1,10000000) > show() > ===================================================== > > The plot looks exactly like I want it, the problem is when I change the > "1"'s to "0"'s in the yarray, then I get a: > > File "C:\Python26\lib\sitepackages\matplotlib\ticker.py", line 1029, in > is_decade > lx = math.log(x)/math.log(base) > ValueError: math domain error > > I suppose that means somewhere a log(0) is attempted. This kind of > defeats the purpose... Yes, it looks like a bug that can be fixed fairly easily. In the meantime, a workaround is to add the kwarg "scaley=False" to your call to "plot"; or more generally, do something like ax = subplot(111) ax.set_autoscaley_on(False) before proceeding with any plotting commands. Eric > > /C > > Quoting Eric Firing <efiring@...>: > >> On 05/19/2010 10:28 AM, Benjamin Root wrote: >>> Maybe I am misunderstanding your problem, but you can select 'semilog' >>> for the x/yscale parameter. >> >> You mean "symlog". >> >> See >> http://matplotlib.sourceforge.net/examples/pylab_examples/symlog_demo.html >> >> >> Although the example doesn't show it, the axis limits don't have to be >> symmetric. For example, on the top plot, you can use >> >> gca().set_xlim([0, 100]) >> >> to show only the righthand side. >> >> Eric >> >> >>> >>> Ben Root >>> >>> On Wed, May 19, 2010 at 7:03 AM, Christer Malmberg >>> <Christer.Malmberg.0653@... >>> <mailto:Christer.Malmberg.0653@...>> wrote: >>> >>> Hi, >>> >>> my problem is that I need a graph with a discontinous yaxis. Let me >>> explain the problem: in my field (microbiology) the data generated >>> from for example growth assays have a huge range (10^010^9), which >>> has to be plotted on a semilogy style plot (cell concentration vs. >>> time). The problem is that 0 cells is a useful number to plot >>> (indicates cell concentration lower than detection limit), but of >>> course not possible to show in a log diagram. This is easily solved on >>> oldstyle logarithmic graph paper; since the data will be either 0, or >>> >1 it is customary just to draw a zero xaxis at 10^1 on the paper >>> and that's that. On the computer, this is extremely hard. Most people >>> I know resort to various tricks in Excel, such as entering a small >>> number (0.001 etc) and starting the yaxis range from 10^1 to hide the >>> problem. This makes excel draw a line, instead of leaving out the dot >>> and line entirely. The part of the curve below the xaxis is then >>> manually cut off in a suitable image editor. Needless to say, this is >>> extremely kludgy. Even professional graphing packages like Graphpad >>> Prism resort to similar kludges (redefine 0 values to 0.1, change the >>> yaxis tick label to "0" etc.) This problem of course exists in other >>> fields, while investigating a solution I found a guy who worked with >>> aerosol contamination in clean rooms, and he needed to plot values >>> logarithmically, at the same time as showing detector noise around >>> 110 particles. He solved it by the same trick I would like to do in >>> Matplotlib, namely plotting a standard semilogy plot but with the >>> 10^1 to 10^0 decade being replaced by a 01 linear axis on the same >>> side. >>> >>> The guy in this post has the same problem and a useful example: >>> http://ubuntuforums.org/showthread.php?t=394851 >>> >>> His partial solution is quite bad though, and I just got stuck while >>> trying to improve it. I looked around the gallery for useful examples, >>> and the closest I could find is the twinx/twiny function, but I didn't >>> manage a plot that put one data curve across both axes. >>> >>> This code gives an image that maybe explains what I'm trying to do: >>> >>> ======================================= >>> t = array([0,1,2,4,6,9,12,24]) >>> y = array([1000000, 500000, 100000, 100, 5, 1, 0, 0]) >>> subplot(111, xscale="linear", yscale="log") >>> errorbar(x, y, yerr=0.4*y) >>> linbit = axes([0.125, 0.1, 0.775, 0.1],frameon=False) >>> linbit.xaxis.set_visible(False) >>> for tl in linbit.get_yticklabels(): >>> tl.set_color('r') >>> show() >>> ======================================= >>> >>> (the y=0 points should be plotted and connected to the line in the >>> log part) >>> >>> Is this possible to do in matplotlib? Could someone give me a pointer >>> on how to go on? >>> >>> Sorry for the long mail, >>> >>> /C >>> >>> >>>  >>> >>> >>> _______________________________________________ >>> Matplotlibusers mailing list >>> Matplotlibusers@... >>> <mailto:Matplotlibusers@...> >>> https://lists.sourceforge.net/lists/listinfo/matplotlibusers >>> >>> >>> >>> >>>  >>> >>> >>> >>> >>> >>> _______________________________________________ >>> Matplotlibusers mailing list >>> Matplotlibusers@... >>> https://lists.sourceforge.net/lists/listinfo/matplotlibusers >> >> >>  >> >> >> _______________________________________________ >> Matplotlibusers mailing list >> Matplotlibusers@... >> https://lists.sourceforge.net/lists/listinfo/matplotlibusers >> > > > 
From: Michael Droettboom <mdroe@st...>  20100520 17:23:45

On 05/20/2010 11:32 AM, Ryan May wrote: > On Thu, May 20, 2010 at 9:34 AM, Michael Droettboom<mdroe@...> wrote: > >> It is a bug, but the broken behavior was kept for backward >> compatibility. Try setting the vertical alignment to 'baseline'. >> >> import matplotlib.pyplot as plt >> fig=plt.figure() >> plt.text(0.4,0.5,"some text", verticalalignment='baseline') >> plt.text(0.6,0.5,"some text with a g in it", verticalalignment='baseline') >> >> It's probably about time to fix this  we will have to update many of >> the unit tests  what do the rest of the devs think? >> > I'm +1, but I've been bitten by this and am not concerned personally > with the backwards incompatibility. I'm not sure how much code out > there is dependant on this. > > I've made baseline the default in SVN r8330. Only two of the unit tests changed due to this  so hopefully it won't be too disruptive for users at large. Mike  Michael Droettboom Science Software Branch Space Telescope Science Institute Baltimore, Maryland, USA 
From: Ryan May <rmay31@gm...>  20100520 15:33:22

On Thu, May 20, 2010 at 9:34 AM, Michael Droettboom <mdroe@...> wrote: > It is a bug, but the broken behavior was kept for backward > compatibility. Try setting the vertical alignment to 'baseline'. > > import matplotlib.pyplot as plt > fig=plt.figure() > plt.text(0.4,0.5,"some text", verticalalignment='baseline') > plt.text(0.6,0.5,"some text with a g in it", verticalalignment='baseline') > > It's probably about time to fix this  we will have to update many of > the unit tests  what do the rest of the devs think? I'm +1, but I've been bitten by this and am not concerned personally with the backwards incompatibility. I'm not sure how much code out there is dependant on this. Ryan  Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma 
From: Benjamin Root <ben.root@ou...>  20100520 14:50:41

Ok, good, I just wanted to do a sanity check. On Thu, May 20, 2010 at 9:21 AM, Michael Droettboom <mdroe@...> wrote: > In this case, yes. The assumption of these (private) functions is that > x will be nonnegative. The only case where we need to worry about log > raising an exception is with exactly 0. > > Mike > > On 05/20/2010 10:08 AM, Benjamin Root wrote: > > Do we really want to depend on a floating point equality? > > > > Ben Root > > > > On Thu, May 20, 2010 at 9:02 AM, Michael Droettboom<mdroe@...> > wrote: > > > > > >> Yep. That's a bug. Here's a patch to fix it: > >> > >> ndex: lib/matplotlib/ticker.py > >> =================================================================== > >>  lib/matplotlib/ticker.py (revision 8323) > >> +++ lib/matplotlib/ticker.py (working copy) > >> @@ 1178,16 +1178,21 @@ > >> > >> def decade_down(x, base=10): > >> 'floor x to the nearest lower decade' > >>  > >> + if x == 0.0: > >> + return base > >> lx = math.floor(math.log(x)/math.log(base)) > >> return base**lx > >> > >> def decade_up(x, base=10): > >> 'ceil x to the nearest higher decade' > >> + if x == 0.0: > >> + return base > >> lx = math.ceil(math.log(x)/math.log(base)) > >> return base**lx > >> > >> def is_decade(x,base=10): > >> + if x == 0.0: > >> + return True > >> lx = math.log(x)/math.log(base) > >> return lx==int(lx) > >> > >> Mike > >> > >> On 05/20/2010 09:43 AM, Christer wrote: > >> > >>> Thank you for the help, I never knew what the symlog flag did actually. > >>> > >>> However, there is still a slight problem: > >>> > >>> ===================================================== > >>> x = array([0,1,2,4,6,9,12,24]) > >>> y = array([1000000, 500000, 100000, 100, 5, 1, 1, 1]) > >>> subplot(111) > >>> plot(x, y) > >>> yscale('symlog') > >>> xscale=('linear') > >>> ylim(1,10000000) > >>> show() > >>> ===================================================== > >>> > >>> The plot looks exactly like I want it, the problem is when I change > >>> the "1"'s to "0"'s in the yarray, then I get a: > >>> > >>> File "C:\Python26\lib\sitepackages\matplotlib\ticker.py", line 1029, > >>> in is_decade > >>> lx = math.log(x)/math.log(base) > >>> ValueError: math domain error > >>> > >>> I suppose that means somewhere a log(0) is attempted. This kind of > >>> defeats the purpose... > >>> > >>> /C > >>> > >>> Quoting Eric Firing<efiring@...>: > >>> > >>> > >>> > >>>> On 05/19/2010 10:28 AM, Benjamin Root wrote: > >>>> > >>>> > >>>>> Maybe I am misunderstanding your problem, but you can select > >>>>> > >>>>> > >>> 'semilog' > >>> > >>> > >>>>> for the x/yscale parameter. > >>>>> > >>>>> > >>>> You mean "symlog". > >>>> > >>>> See > >>>> > >>>> > >>>> > >>> > >> > http://matplotlib.sourceforge.net/examples/pylab_examples/symlog_demo.html > >> > >>> > >>>> Although the example doesn't show it, the axis limits don't have to be > >>>> symmetric. For example, on the top plot, you can use > >>>> > >>>> gca().set_xlim([0, 100]) > >>>> > >>>> to show only the righthand side. > >>>> > >>>> Eric > >>>> > >>>> > >>>> > >>>> > >>>>> Ben Root > >>>>> > >>>>> On Wed, May 19, 2010 at 7:03 AM, Christer Malmberg > >>>>> <Christer.Malmberg.0653@... > >>>>> <mailto:Christer.Malmberg.0653@...>> wrote: > >>>>> > >>>>> Hi, > >>>>> > >>>>> my problem is that I need a graph with a discontinous yaxis. > Let > >>>>> > >>>>> > >>> me > >>> > >>> > >>>>> explain the problem: in my field (microbiology) the data > >>>>> > >>>>> > >>> generated > >>> > >>> > >>>>> from for example growth assays have a huge range (10^010^9), > >>>>> > >>>>> > >>> which > >>> > >>> > >>>>> has to be plotted on a semilogy style plot (cell concentration > >>>>> > >>>>> > >>> vs. > >>> > >>> > >>>>> time). The problem is that 0 cells is a useful number to plot > >>>>> (indicates cell concentration lower than detection limit), but > of > >>>>> course not possible to show in a log diagram. This is easily > >>>>> > >>>>> > >>> solved on > >>> > >>> > >>>>> oldstyle logarithmic graph paper; since the data will be > either > >>>>> > >>>>> > >>> 0, or > >>> > >>> > >>>>> >1 it is customary just to draw a zero xaxis at 10^1 on the > >>>>> > >>>>> > >>> paper > >>> > >>> > >>>>> and that's that. On the computer, this is extremely hard. Most > >>>>> > >>>>> > >>> people > >>> > >>> > >>>>> I know resort to various tricks in Excel, such as entering a > >>>>> > >>>>> > >>> small > >>> > >>> > >>>>> number (0.001 etc) and starting the yaxis range from 10^1 to > >>>>> > >>>>> > >>> hide the > >>> > >>> > >>>>> problem. This makes excel draw a line, instead of leaving out > the > >>>>> > >>>>> > >>> dot > >>> > >>> > >>>>> and line entirely. The part of the curve below the xaxis is > then > >>>>> manually cut off in a suitable image editor. Needless to say, > >>>>> > >>>>> > >>> this is > >>> > >>> > >>>>> extremely kludgy. Even professional graphing packages like > >>>>> > >>>>> > >>> Graphpad > >>> > >>> > >>>>> Prism resort to similar kludges (redefine 0 values to 0.1, > >>>>> > >>>>> > >>> change the > >>> > >>> > >>>>> yaxis tick label to "0" etc.) This problem of course exists in > >>>>> > >>>>> > >>> other > >>> > >>> > >>>>> fields, while investigating a solution I found a guy who worked > >>>>> > >>>>> > >>> with > >>> > >>> > >>>>> aerosol contamination in clean rooms, and he needed to plot > >>>>> > >>>>> > >>> values > >>> > >>> > >>>>> logarithmically, at the same time as showing detector noise > >>>>> > >>>>> > >>> around > >>> > >>> > >>>>> 110 particles. He solved it by the same trick I would like to > do > >>>>> > >>>>> > >>> in > >>> > >>> > >>>>> Matplotlib, namely plotting a standard semilogy plot but with > the > >>>>> 10^1 to 10^0 decade being replaced by a 01 linear axis on the > >>>>> > >>>>> > >>> same > >>> > >>> > >>>>> side. > >>>>> > >>>>> The guy in this post has the same problem and a useful example: > >>>>> http://ubuntuforums.org/showthread.php?t=394851 > >>>>> > >>>>> His partial solution is quite bad though, and I just got stuck > >>>>> > >>>>> > >>> while > >>> > >>> > >>>>> trying to improve it. I looked around the gallery for useful > >>>>> > >>>>> > >>> examples, > >>> > >>> > >>>>> and the closest I could find is the twinx/twiny function, but I > >>>>> > >>>>> > >>> didn't > >>> > >>> > >>>>> manage a plot that put one data curve across both axes. > >>>>> > >>>>> This code gives an image that maybe explains what I'm trying to > >>>>> > >>>>> > >>> do: > >>> > >>> > >>>>> ======================================= > >>>>> t = array([0,1,2,4,6,9,12,24]) > >>>>> y = array([1000000, 500000, 100000, 100, 5, 1, 0, 0]) > >>>>> subplot(111, xscale="linear", yscale="log") > >>>>> errorbar(x, y, yerr=0.4*y) > >>>>> linbit = axes([0.125, 0.1, 0.775, 0.1],frameon=False) > >>>>> linbit.xaxis.set_visible(False) > >>>>> for tl in linbit.get_yticklabels(): > >>>>> tl.set_color('r') > >>>>> show() > >>>>> ======================================= > >>>>> > >>>>> (the y=0 points should be plotted and connected to the line in > >>>>> > >>>>> > >>> the > >>> > >>> > >>>>> log part) > >>>>> > >>>>> Is this possible to do in matplotlib? Could someone give me a > >>>>> > >>>>> > >>> pointer > >>> > >>> > >>>>> on how to go on? > >>>>> > >>>>> Sorry for the long mail, > >>>>> > >>>>> /C > >>>>> > >>>>> > >>>>> > >>>>> > >>>>> > >>>>> > >>> > >> >  > >> > >>> > >>>>> _______________________________________________ > >>>>> Matplotlibusers mailing list > >>>>> Matplotlibusers@... > >>>>> <mailto:Matplotlibusers@...> > >>>>> https://lists.sourceforge.net/lists/listinfo/matplotlibusers > >>>>> > >>>>> > >>>>> > >>>>> > >>>>> > >>>>> > >>>>> > >>> > >> >  > >> > >>> > >>>>> > >>>>> > >>>>> _______________________________________________ > >>>>> Matplotlibusers mailing list > >>>>> Matplotlibusers@... > >>>>> https://lists.sourceforge.net/lists/listinfo/matplotlibusers > >>>>> > >>>>> > >>>> > >>>> > >>>> > >>> > >> >  > >> > >>> > >>>> _______________________________________________ > >>>> Matplotlibusers mailing list > >>>> Matplotlibusers@... > >>>> https://lists.sourceforge.net/lists/listinfo/matplotlibusers > >>>> > >>>> > >>>> > >>> > >>> > >>> > >> >  > >> > >>> _______________________________________________ > >>> Matplotlibusers mailing list > >>> Matplotlibusers@... > >>> https://lists.sourceforge.net/lists/listinfo/matplotlibusers > >>> > >>> > >> > >>  > >> Michael Droettboom > >> Science Software Branch > >> Space Telescope Science Institute > >> Baltimore, Maryland, USA > >> > >> > >> > >> >  > >> > >> _______________________________________________ > >> Matplotlibusers mailing list > >> Matplotlibusers@... > >> https://lists.sourceforge.net/lists/listinfo/matplotlibusers > >> > >> > > > > >  > Michael Droettboom > Science Software Branch > Space Telescope Science Institute > Baltimore, Maryland, USA > > > >  > > _______________________________________________ > Matplotlibusers mailing list > Matplotlibusers@... > https://lists.sourceforge.net/lists/listinfo/matplotlibusers > 
From: Michael Droettboom <mdroe@st...>  20100520 14:35:07

It is a bug, but the broken behavior was kept for backward compatibility. Try setting the vertical alignment to 'baseline'. import matplotlib.pyplot as plt fig=plt.figure() plt.text(0.4,0.5,"some text", verticalalignment='baseline') plt.text(0.6,0.5,"some text with a g in it", verticalalignment='baseline') It's probably about time to fix this  we will have to update many of the unit tests  what do the rest of the devs think? Mike On 05/20/2010 10:28 AM, Nick Schurch wrote: > I've also discovered another text problem. If I add two lines of test > to a plot as follows: > > import mapplotlib.pyplot as plt > fig=plt.figure() > plt.text(0.4,0.5,"some text") > plt.text(0.6,0.5,"some more text") > > then the two sets of text line up nicely with each other, because they > have the same yaxis position. But if I do: > > import mapplotlib.pyplot as plt > fig=plt.figure() > plt.text(0.4,0.5,"some text") > plt.text(0.6,0.5,"some text with a g in it") > > then the "some text with a g in it" is shifted upwards slightly so > that the bottom of "some text" lines up with the bottom of the "g", > and doesn't line up witht he rest of the letters. It look like they > are not on the same line! This has got to be a bug in the way > matplotlib deals with text. > >  > Cheers, > > Nick Schurch > > Data Analysis Group (The Barton Group), > School of Life Sciences, > University of Dundee, > Dow St, > Dundee, > DD1 5EH, > Scotland, > UK > > Tel: +44 1382 388707 > Fax: +44 1382 345 893 > > > >  Michael Droettboom Science Software Branch Space Telescope Science Institute Baltimore, Maryland, USA 
From: Michael Droettboom <mdroe@st...>  20100520 14:32:18

That will only work if you have a smallcaps variant of the font installed (which the vast majority of fonts do not). matplotlib does not do any font synthesis at all  i.e. it does not create a pseudo font variation when one does not exist on disk. Mike On 05/20/2010 10:19 AM, Nick Schurch wrote: > Hi all, > > I'm adding some text to a plt like this: > > import mapplotlib.pyplot as plt > fig=plt.figure() > plt.text(0.5,0.5,"some text", variant='smallcaps') > > but the text that is plotted is not small caps, its just normal. Is > this a bug or am I doing something wrong? > >  Michael Droettboom Science Software Branch Space Telescope Science Institute Baltimore, Maryland, USA 
From: Nick Schurch <N.Schurch@du...>  20100520 14:29:15

I've also discovered another text problem. If I add two lines of test to a plot as follows: import mapplotlib.pyplot as plt fig=plt.figure() plt.text(0.4,0.5,"some text") plt.text(0.6,0.5,"some more text") then the two sets of text line up nicely with each other, because they have the same yaxis position. But if I do: import mapplotlib.pyplot as plt fig=plt.figure() plt.text(0.4,0.5,"some text") plt.text(0.6,0.5,"some text with a g in it") then the "some text with a g in it" is shifted upwards slightly so that the bottom of "some text" lines up with the bottom of the "g", and doesn't line up witht he rest of the letters. It look like they are not on the same line! This has got to be a bug in the way matplotlib deals with text.  Cheers, Nick Schurch Data Analysis Group (The Barton Group), School of Life Sciences, University of Dundee, Dow St, Dundee, DD1 5EH, Scotland, UK Tel: +44 1382 388707 Fax: +44 1382 345 893  Cheers, Nick Schurch Data Analysis Group (The Barton Group), School of Life Sciences, University of Dundee, Dow St, Dundee, DD1 5EH, Scotland, UK Tel: +44 1382 388707 Fax: +44 1382 345 893 
From: Michael Droettboom <mdroe@st...>  20100520 14:22:52

In this case, yes. The assumption of these (private) functions is that x will be nonnegative. The only case where we need to worry about log raising an exception is with exactly 0. Mike On 05/20/2010 10:08 AM, Benjamin Root wrote: > Do we really want to depend on a floating point equality? > > Ben Root > > On Thu, May 20, 2010 at 9:02 AM, Michael Droettboom<mdroe@...> wrote: > > >> Yep. That's a bug. Here's a patch to fix it: >> >> ndex: lib/matplotlib/ticker.py >> =================================================================== >>  lib/matplotlib/ticker.py (revision 8323) >> +++ lib/matplotlib/ticker.py (working copy) >> @@ 1178,16 +1178,21 @@ >> >> def decade_down(x, base=10): >> 'floor x to the nearest lower decade' >>  >> + if x == 0.0: >> + return base >> lx = math.floor(math.log(x)/math.log(base)) >> return base**lx >> >> def decade_up(x, base=10): >> 'ceil x to the nearest higher decade' >> + if x == 0.0: >> + return base >> lx = math.ceil(math.log(x)/math.log(base)) >> return base**lx >> >> def is_decade(x,base=10): >> + if x == 0.0: >> + return True >> lx = math.log(x)/math.log(base) >> return lx==int(lx) >> >> Mike >> >> On 05/20/2010 09:43 AM, Christer wrote: >> >>> Thank you for the help, I never knew what the symlog flag did actually. >>> >>> However, there is still a slight problem: >>> >>> ===================================================== >>> x = array([0,1,2,4,6,9,12,24]) >>> y = array([1000000, 500000, 100000, 100, 5, 1, 1, 1]) >>> subplot(111) >>> plot(x, y) >>> yscale('symlog') >>> xscale=('linear') >>> ylim(1,10000000) >>> show() >>> ===================================================== >>> >>> The plot looks exactly like I want it, the problem is when I change >>> the "1"'s to "0"'s in the yarray, then I get a: >>> >>> File "C:\Python26\lib\sitepackages\matplotlib\ticker.py", line 1029, >>> in is_decade >>> lx = math.log(x)/math.log(base) >>> ValueError: math domain error >>> >>> I suppose that means somewhere a log(0) is attempted. This kind of >>> defeats the purpose... >>> >>> /C >>> >>> Quoting Eric Firing<efiring@...>: >>> >>> >>> >>>> On 05/19/2010 10:28 AM, Benjamin Root wrote: >>>> >>>> >>>>> Maybe I am misunderstanding your problem, but you can select >>>>> >>>>> >>> 'semilog' >>> >>> >>>>> for the x/yscale parameter. >>>>> >>>>> >>>> You mean "symlog". >>>> >>>> See >>>> >>>> >>>> >>> >> http://matplotlib.sourceforge.net/examples/pylab_examples/symlog_demo.html >> >>> >>>> Although the example doesn't show it, the axis limits don't have to be >>>> symmetric. For example, on the top plot, you can use >>>> >>>> gca().set_xlim([0, 100]) >>>> >>>> to show only the righthand side. >>>> >>>> Eric >>>> >>>> >>>> >>>> >>>>> Ben Root >>>>> >>>>> On Wed, May 19, 2010 at 7:03 AM, Christer Malmberg >>>>> <Christer.Malmberg.0653@... >>>>> <mailto:Christer.Malmberg.0653@...>> wrote: >>>>> >>>>> Hi, >>>>> >>>>> my problem is that I need a graph with a discontinous yaxis. Let >>>>> >>>>> >>> me >>> >>> >>>>> explain the problem: in my field (microbiology) the data >>>>> >>>>> >>> generated >>> >>> >>>>> from for example growth assays have a huge range (10^010^9), >>>>> >>>>> >>> which >>> >>> >>>>> has to be plotted on a semilogy style plot (cell concentration >>>>> >>>>> >>> vs. >>> >>> >>>>> time). The problem is that 0 cells is a useful number to plot >>>>> (indicates cell concentration lower than detection limit), but of >>>>> course not possible to show in a log diagram. This is easily >>>>> >>>>> >>> solved on >>> >>> >>>>> oldstyle logarithmic graph paper; since the data will be either >>>>> >>>>> >>> 0, or >>> >>> >>>>> >1 it is customary just to draw a zero xaxis at 10^1 on the >>>>> >>>>> >>> paper >>> >>> >>>>> and that's that. On the computer, this is extremely hard. Most >>>>> >>>>> >>> people >>> >>> >>>>> I know resort to various tricks in Excel, such as entering a >>>>> >>>>> >>> small >>> >>> >>>>> number (0.001 etc) and starting the yaxis range from 10^1 to >>>>> >>>>> >>> hide the >>> >>> >>>>> problem. This makes excel draw a line, instead of leaving out the >>>>> >>>>> >>> dot >>> >>> >>>>> and line entirely. The part of the curve below the xaxis is then >>>>> manually cut off in a suitable image editor. Needless to say, >>>>> >>>>> >>> this is >>> >>> >>>>> extremely kludgy. Even professional graphing packages like >>>>> >>>>> >>> Graphpad >>> >>> >>>>> Prism resort to similar kludges (redefine 0 values to 0.1, >>>>> >>>>> >>> change the >>> >>> >>>>> yaxis tick label to "0" etc.) This problem of course exists in >>>>> >>>>> >>> other >>> >>> >>>>> fields, while investigating a solution I found a guy who worked >>>>> >>>>> >>> with >>> >>> >>>>> aerosol contamination in clean rooms, and he needed to plot >>>>> >>>>> >>> values >>> >>> >>>>> logarithmically, at the same time as showing detector noise >>>>> >>>>> >>> around >>> >>> >>>>> 110 particles. He solved it by the same trick I would like to do >>>>> >>>>> >>> in >>> >>> >>>>> Matplotlib, namely plotting a standard semilogy plot but with the >>>>> 10^1 to 10^0 decade being replaced by a 01 linear axis on the >>>>> >>>>> >>> same >>> >>> >>>>> side. >>>>> >>>>> The guy in this post has the same problem and a useful example: >>>>> http://ubuntuforums.org/showthread.php?t=394851 >>>>> >>>>> His partial solution is quite bad though, and I just got stuck >>>>> >>>>> >>> while >>> >>> >>>>> trying to improve it. I looked around the gallery for useful >>>>> >>>>> >>> examples, >>> >>> >>>>> and the closest I could find is the twinx/twiny function, but I >>>>> >>>>> >>> didn't >>> >>> >>>>> manage a plot that put one data curve across both axes. >>>>> >>>>> This code gives an image that maybe explains what I'm trying to >>>>> >>>>> >>> do: >>> >>> >>>>> ======================================= >>>>> t = array([0,1,2,4,6,9,12,24]) >>>>> y = array([1000000, 500000, 100000, 100, 5, 1, 0, 0]) >>>>> subplot(111, xscale="linear", yscale="log") >>>>> errorbar(x, y, yerr=0.4*y) >>>>> linbit = axes([0.125, 0.1, 0.775, 0.1],frameon=False) >>>>> linbit.xaxis.set_visible(False) >>>>> for tl in linbit.get_yticklabels(): >>>>> tl.set_color('r') >>>>> show() >>>>> ======================================= >>>>> >>>>> (the y=0 points should be plotted and connected to the line in >>>>> >>>>> >>> the >>> >>> >>>>> log part) >>>>> >>>>> Is this possible to do in matplotlib? Could someone give me a >>>>> >>>>> >>> pointer >>> >>> >>>>> on how to go on? >>>>> >>>>> Sorry for the long mail, >>>>> >>>>> /C >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>> >>  >> >>> >>>>> _______________________________________________ >>>>> Matplotlibusers mailing list >>>>> Matplotlibusers@... >>>>> <mailto:Matplotlibusers@...> >>>>> https://lists.sourceforge.net/lists/listinfo/matplotlibusers >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>> >>  >> >>> >>>>> >>>>> >>>>> _______________________________________________ >>>>> Matplotlibusers mailing list >>>>> Matplotlibusers@... >>>>> https://lists.sourceforge.net/lists/listinfo/matplotlibusers >>>>> >>>>> >>>> >>>> >>>> >>> >>  >> >>> >>>> _______________________________________________ >>>> Matplotlibusers mailing list >>>> Matplotlibusers@... >>>> https://lists.sourceforge.net/lists/listinfo/matplotlibusers >>>> >>>> >>>> >>> >>> >>> >>  >> >>> _______________________________________________ >>> Matplotlibusers mailing list >>> Matplotlibusers@... >>> https://lists.sourceforge.net/lists/listinfo/matplotlibusers >>> >>> >> >>  >> Michael Droettboom >> Science Software Branch >> Space Telescope Science Institute >> Baltimore, Maryland, USA >> >> >> >>  >> >> _______________________________________________ >> Matplotlibusers mailing list >> Matplotlibusers@... >> https://lists.sourceforge.net/lists/listinfo/matplotlibusers >> >> >  Michael Droettboom Science Software Branch Space Telescope Science Institute Baltimore, Maryland, USA 
From: Nick Schurch <N.Schurch@du...>  20100520 14:20:08

Hi all, I'm adding some text to a plt like this: import mapplotlib.pyplot as plt fig=plt.figure() plt.text(0.5,0.5,"some text", variant='smallcaps') but the text that is plotted is not small caps, its just normal. Is this a bug or am I doing something wrong?  Cheers, Nick Schurch Data Analysis Group (The Barton Group), School of Life Sciences, University of Dundee, Dow St, Dundee, DD1 5EH, Scotland, UK Tel: +44 1382 388707 Fax: +44 1382 345 893 
From: Benjamin Root <ben.root@ou...>  20100520 14:09:24

Do we really want to depend on a floating point equality? Ben Root On Thu, May 20, 2010 at 9:02 AM, Michael Droettboom <mdroe@...> wrote: > Yep. That's a bug. Here's a patch to fix it: > > ndex: lib/matplotlib/ticker.py > =================================================================== >  lib/matplotlib/ticker.py (revision 8323) > +++ lib/matplotlib/ticker.py (working copy) > @@ 1178,16 +1178,21 @@ > > def decade_down(x, base=10): > 'floor x to the nearest lower decade' >  > + if x == 0.0: > + return base > lx = math.floor(math.log(x)/math.log(base)) > return base**lx > > def decade_up(x, base=10): > 'ceil x to the nearest higher decade' > + if x == 0.0: > + return base > lx = math.ceil(math.log(x)/math.log(base)) > return base**lx > > def is_decade(x,base=10): > + if x == 0.0: > + return True > lx = math.log(x)/math.log(base) > return lx==int(lx) > > Mike > > On 05/20/2010 09:43 AM, Christer wrote: > > Thank you for the help, I never knew what the symlog flag did actually. > > > > However, there is still a slight problem: > > > > ===================================================== > > x = array([0,1,2,4,6,9,12,24]) > > y = array([1000000, 500000, 100000, 100, 5, 1, 1, 1]) > > subplot(111) > > plot(x, y) > > yscale('symlog') > > xscale=('linear') > > ylim(1,10000000) > > show() > > ===================================================== > > > > The plot looks exactly like I want it, the problem is when I change > > the "1"'s to "0"'s in the yarray, then I get a: > > > > File "C:\Python26\lib\sitepackages\matplotlib\ticker.py", line 1029, > > in is_decade > > lx = math.log(x)/math.log(base) > > ValueError: math domain error > > > > I suppose that means somewhere a log(0) is attempted. This kind of > > defeats the purpose... > > > > /C > > > > Quoting Eric Firing<efiring@...>: > > > > > >> On 05/19/2010 10:28 AM, Benjamin Root wrote: > >> > >>> Maybe I am misunderstanding your problem, but you can select > >>> > > 'semilog' > > > >>> for the x/yscale parameter. > >>> > >> You mean "symlog". > >> > >> See > >> > >> > > > http://matplotlib.sourceforge.net/examples/pylab_examples/symlog_demo.html > > > >> Although the example doesn't show it, the axis limits don't have to be > >> symmetric. For example, on the top plot, you can use > >> > >> gca().set_xlim([0, 100]) > >> > >> to show only the righthand side. > >> > >> Eric > >> > >> > >> > >>> Ben Root > >>> > >>> On Wed, May 19, 2010 at 7:03 AM, Christer Malmberg > >>> <Christer.Malmberg.0653@... > >>> <mailto:Christer.Malmberg.0653@...>> wrote: > >>> > >>> Hi, > >>> > >>> my problem is that I need a graph with a discontinous yaxis. Let > >>> > > me > > > >>> explain the problem: in my field (microbiology) the data > >>> > > generated > > > >>> from for example growth assays have a huge range (10^010^9), > >>> > > which > > > >>> has to be plotted on a semilogy style plot (cell concentration > >>> > > vs. > > > >>> time). The problem is that 0 cells is a useful number to plot > >>> (indicates cell concentration lower than detection limit), but of > >>> course not possible to show in a log diagram. This is easily > >>> > > solved on > > > >>> oldstyle logarithmic graph paper; since the data will be either > >>> > > 0, or > > > >>> >1 it is customary just to draw a zero xaxis at 10^1 on the > >>> > > paper > > > >>> and that's that. On the computer, this is extremely hard. Most > >>> > > people > > > >>> I know resort to various tricks in Excel, such as entering a > >>> > > small > > > >>> number (0.001 etc) and starting the yaxis range from 10^1 to > >>> > > hide the > > > >>> problem. This makes excel draw a line, instead of leaving out the > >>> > > dot > > > >>> and line entirely. The part of the curve below the xaxis is then > >>> manually cut off in a suitable image editor. Needless to say, > >>> > > this is > > > >>> extremely kludgy. Even professional graphing packages like > >>> > > Graphpad > > > >>> Prism resort to similar kludges (redefine 0 values to 0.1, > >>> > > change the > > > >>> yaxis tick label to "0" etc.) This problem of course exists in > >>> > > other > > > >>> fields, while investigating a solution I found a guy who worked > >>> > > with > > > >>> aerosol contamination in clean rooms, and he needed to plot > >>> > > values > > > >>> logarithmically, at the same time as showing detector noise > >>> > > around > > > >>> 110 particles. He solved it by the same trick I would like to do > >>> > > in > > > >>> Matplotlib, namely plotting a standard semilogy plot but with the > >>> 10^1 to 10^0 decade being replaced by a 01 linear axis on the > >>> > > same > > > >>> side. > >>> > >>> The guy in this post has the same problem and a useful example: > >>> http://ubuntuforums.org/showthread.php?t=394851 > >>> > >>> His partial solution is quite bad though, and I just got stuck > >>> > > while > > > >>> trying to improve it. I looked around the gallery for useful > >>> > > examples, > > > >>> and the closest I could find is the twinx/twiny function, but I > >>> > > didn't > > > >>> manage a plot that put one data curve across both axes. > >>> > >>> This code gives an image that maybe explains what I'm trying to > >>> > > do: > > > >>> ======================================= > >>> t = array([0,1,2,4,6,9,12,24]) > >>> y = array([1000000, 500000, 100000, 100, 5, 1, 0, 0]) > >>> subplot(111, xscale="linear", yscale="log") > >>> errorbar(x, y, yerr=0.4*y) > >>> linbit = axes([0.125, 0.1, 0.775, 0.1],frameon=False) > >>> linbit.xaxis.set_visible(False) > >>> for tl in linbit.get_yticklabels(): > >>> tl.set_color('r') > >>> show() > >>> ======================================= > >>> > >>> (the y=0 points should be plotted and connected to the line in > >>> > > the > > > >>> log part) > >>> > >>> Is this possible to do in matplotlib? Could someone give me a > >>> > > pointer > > > >>> on how to go on? > >>> > >>> Sorry for the long mail, > >>> > >>> /C > >>> > >>> > >>> > >>> > >>> > > >  > > > >>> _______________________________________________ > >>> Matplotlibusers mailing list > >>> Matplotlibusers@... > >>> <mailto:Matplotlibusers@...> > >>> https://lists.sourceforge.net/lists/listinfo/matplotlibusers > >>> > >>> > >>> > >>> > >>> > >>> > > >  > > > >>> > >>> > >>> > >>> _______________________________________________ > >>> Matplotlibusers mailing list > >>> Matplotlibusers@... > >>> https://lists.sourceforge.net/lists/listinfo/matplotlibusers > >>> > >> > >> > >> > > >  > > > >> _______________________________________________ > >> Matplotlibusers mailing list > >> Matplotlibusers@... > >> https://lists.sourceforge.net/lists/listinfo/matplotlibusers > >> > >> > > > > > > >  > > > > _______________________________________________ > > Matplotlibusers mailing list > > Matplotlibusers@... > > https://lists.sourceforge.net/lists/listinfo/matplotlibusers > > > > >  > Michael Droettboom > Science Software Branch > Space Telescope Science Institute > Baltimore, Maryland, USA > > > >  > > _______________________________________________ > Matplotlibusers mailing list > Matplotlibusers@... > https://lists.sourceforge.net/lists/listinfo/matplotlibusers > 
From: Michael Droettboom <mdroe@st...>  20100520 14:02:51

Yep. That's a bug. Here's a patch to fix it: ndex: lib/matplotlib/ticker.py ===================================================================  lib/matplotlib/ticker.py (revision 8323) +++ lib/matplotlib/ticker.py (working copy) @@ 1178,16 +1178,21 @@ def decade_down(x, base=10): 'floor x to the nearest lower decade'  + if x == 0.0: + return base lx = math.floor(math.log(x)/math.log(base)) return base**lx def decade_up(x, base=10): 'ceil x to the nearest higher decade' + if x == 0.0: + return base lx = math.ceil(math.log(x)/math.log(base)) return base**lx def is_decade(x,base=10): + if x == 0.0: + return True lx = math.log(x)/math.log(base) return lx==int(lx) Mike On 05/20/2010 09:43 AM, Christer wrote: > Thank you for the help, I never knew what the symlog flag did actually. > > However, there is still a slight problem: > > ===================================================== > x = array([0,1,2,4,6,9,12,24]) > y = array([1000000, 500000, 100000, 100, 5, 1, 1, 1]) > subplot(111) > plot(x, y) > yscale('symlog') > xscale=('linear') > ylim(1,10000000) > show() > ===================================================== > > The plot looks exactly like I want it, the problem is when I change > the "1"'s to "0"'s in the yarray, then I get a: > > File "C:\Python26\lib\sitepackages\matplotlib\ticker.py", line 1029, > in is_decade > lx = math.log(x)/math.log(base) > ValueError: math domain error > > I suppose that means somewhere a log(0) is attempted. This kind of > defeats the purpose... > > /C > > Quoting Eric Firing<efiring@...>: > > >> On 05/19/2010 10:28 AM, Benjamin Root wrote: >> >>> Maybe I am misunderstanding your problem, but you can select >>> > 'semilog' > >>> for the x/yscale parameter. >>> >> You mean "symlog". >> >> See >> >> > http://matplotlib.sourceforge.net/examples/pylab_examples/symlog_demo.html > >> Although the example doesn't show it, the axis limits don't have to be >> symmetric. For example, on the top plot, you can use >> >> gca().set_xlim([0, 100]) >> >> to show only the righthand side. >> >> Eric >> >> >> >>> Ben Root >>> >>> On Wed, May 19, 2010 at 7:03 AM, Christer Malmberg >>> <Christer.Malmberg.0653@... >>> <mailto:Christer.Malmberg.0653@...>> wrote: >>> >>> Hi, >>> >>> my problem is that I need a graph with a discontinous yaxis. Let >>> > me > >>> explain the problem: in my field (microbiology) the data >>> > generated > >>> from for example growth assays have a huge range (10^010^9), >>> > which > >>> has to be plotted on a semilogy style plot (cell concentration >>> > vs. > >>> time). The problem is that 0 cells is a useful number to plot >>> (indicates cell concentration lower than detection limit), but of >>> course not possible to show in a log diagram. This is easily >>> > solved on > >>> oldstyle logarithmic graph paper; since the data will be either >>> > 0, or > >>> >1 it is customary just to draw a zero xaxis at 10^1 on the >>> > paper > >>> and that's that. On the computer, this is extremely hard. Most >>> > people > >>> I know resort to various tricks in Excel, such as entering a >>> > small > >>> number (0.001 etc) and starting the yaxis range from 10^1 to >>> > hide the > >>> problem. This makes excel draw a line, instead of leaving out the >>> > dot > >>> and line entirely. The part of the curve below the xaxis is then >>> manually cut off in a suitable image editor. Needless to say, >>> > this is > >>> extremely kludgy. Even professional graphing packages like >>> > Graphpad > >>> Prism resort to similar kludges (redefine 0 values to 0.1, >>> > change the > >>> yaxis tick label to "0" etc.) This problem of course exists in >>> > other > >>> fields, while investigating a solution I found a guy who worked >>> > with > >>> aerosol contamination in clean rooms, and he needed to plot >>> > values > >>> logarithmically, at the same time as showing detector noise >>> > around > >>> 110 particles. He solved it by the same trick I would like to do >>> > in > >>> Matplotlib, namely plotting a standard semilogy plot but with the >>> 10^1 to 10^0 decade being replaced by a 01 linear axis on the >>> > same > >>> side. >>> >>> The guy in this post has the same problem and a useful example: >>> http://ubuntuforums.org/showthread.php?t=394851 >>> >>> His partial solution is quite bad though, and I just got stuck >>> > while > >>> trying to improve it. I looked around the gallery for useful >>> > examples, > >>> and the closest I could find is the twinx/twiny function, but I >>> > didn't > >>> manage a plot that put one data curve across both axes. >>> >>> This code gives an image that maybe explains what I'm trying to >>> > do: > >>> ======================================= >>> t = array([0,1,2,4,6,9,12,24]) >>> y = array([1000000, 500000, 100000, 100, 5, 1, 0, 0]) >>> subplot(111, xscale="linear", yscale="log") >>> errorbar(x, y, yerr=0.4*y) >>> linbit = axes([0.125, 0.1, 0.775, 0.1],frameon=False) >>> linbit.xaxis.set_visible(False) >>> for tl in linbit.get_yticklabels(): >>> tl.set_color('r') >>> show() >>> ======================================= >>> >>> (the y=0 points should be plotted and connected to the line in >>> > the > >>> log part) >>> >>> Is this possible to do in matplotlib? Could someone give me a >>> > pointer > >>> on how to go on? >>> >>> Sorry for the long mail, >>> >>> /C >>> >>> >>> >>> >>> >  > >>> _______________________________________________ >>> Matplotlibusers mailing list >>> Matplotlibusers@... >>> <mailto:Matplotlibusers@...> >>> https://lists.sourceforge.net/lists/listinfo/matplotlibusers >>> >>> >>> >>> >>> >>> >  > >>> >>> >>> >>> _______________________________________________ >>> Matplotlibusers mailing list >>> Matplotlibusers@... >>> https://lists.sourceforge.net/lists/listinfo/matplotlibusers >>> >> >> >> >  > >> _______________________________________________ >> Matplotlibusers mailing list >> Matplotlibusers@... >> https://lists.sourceforge.net/lists/listinfo/matplotlibusers >> >> > > >  > > _______________________________________________ > Matplotlibusers mailing list > Matplotlibusers@... > https://lists.sourceforge.net/lists/listinfo/matplotlibusers >  Michael Droettboom Science Software Branch Space Telescope Science Institute Baltimore, Maryland, USA 
From: Christer <chma0653@st...>  20100520 13:43:54

Thank you for the help, I never knew what the symlog flag did actually. However, there is still a slight problem: ===================================================== x = array([0,1,2,4,6,9,12,24]) y = array([1000000, 500000, 100000, 100, 5, 1, 1, 1]) subplot(111) plot(x, y) yscale('symlog') xscale=('linear') ylim(1,10000000) show() ===================================================== The plot looks exactly like I want it, the problem is when I change the "1"'s to "0"'s in the yarray, then I get a: File "C:\Python26\lib\sitepackages\matplotlib\ticker.py", line 1029, in is_decade lx = math.log(x)/math.log(base) ValueError: math domain error I suppose that means somewhere a log(0) is attempted. This kind of defeats the purpose... /C Quoting Eric Firing <efiring@...>: > On 05/19/2010 10:28 AM, Benjamin Root wrote: >> Maybe I am misunderstanding your problem, but you can select 'semilog' >> for the x/yscale parameter. > > You mean "symlog". > > See > http://matplotlib.sourceforge.net/examples/pylab_examples/symlog_demo.html > > Although the example doesn't show it, the axis limits don't have to be > symmetric. For example, on the top plot, you can use > > gca().set_xlim([0, 100]) > > to show only the righthand side. > > Eric > > >> >> Ben Root >> >> On Wed, May 19, 2010 at 7:03 AM, Christer Malmberg >> <Christer.Malmberg.0653@... >> <mailto:Christer.Malmberg.0653@...>> wrote: >> >> Hi, >> >> my problem is that I need a graph with a discontinous yaxis. Let me >> explain the problem: in my field (microbiology) the data generated >> from for example growth assays have a huge range (10^010^9), which >> has to be plotted on a semilogy style plot (cell concentration vs. >> time). The problem is that 0 cells is a useful number to plot >> (indicates cell concentration lower than detection limit), but of >> course not possible to show in a log diagram. This is easily solved on >> oldstyle logarithmic graph paper; since the data will be either 0, or >> >1 it is customary just to draw a zero xaxis at 10^1 on the paper >> and that's that. On the computer, this is extremely hard. Most people >> I know resort to various tricks in Excel, such as entering a small >> number (0.001 etc) and starting the yaxis range from 10^1 to hide the >> problem. This makes excel draw a line, instead of leaving out the dot >> and line entirely. The part of the curve below the xaxis is then >> manually cut off in a suitable image editor. Needless to say, this is >> extremely kludgy. Even professional graphing packages like Graphpad >> Prism resort to similar kludges (redefine 0 values to 0.1, change the >> yaxis tick label to "0" etc.) This problem of course exists in other >> fields, while investigating a solution I found a guy who worked with >> aerosol contamination in clean rooms, and he needed to plot values >> logarithmically, at the same time as showing detector noise around >> 110 particles. He solved it by the same trick I would like to do in >> Matplotlib, namely plotting a standard semilogy plot but with the >> 10^1 to 10^0 decade being replaced by a 01 linear axis on the same >> side. >> >> The guy in this post has the same problem and a useful example: >> http://ubuntuforums.org/showthread.php?t=394851 >> >> His partial solution is quite bad though, and I just got stuck while >> trying to improve it. I looked around the gallery for useful examples, >> and the closest I could find is the twinx/twiny function, but I didn't >> manage a plot that put one data curve across both axes. >> >> This code gives an image that maybe explains what I'm trying to do: >> >> ======================================= >> t = array([0,1,2,4,6,9,12,24]) >> y = array([1000000, 500000, 100000, 100, 5, 1, 0, 0]) >> subplot(111, xscale="linear", yscale="log") >> errorbar(x, y, yerr=0.4*y) >> linbit = axes([0.125, 0.1, 0.775, 0.1],frameon=False) >> linbit.xaxis.set_visible(False) >> for tl in linbit.get_yticklabels(): >> tl.set_color('r') >> show() >> ======================================= >> >> (the y=0 points should be plotted and connected to the line in the >> log part) >> >> Is this possible to do in matplotlib? Could someone give me a pointer >> on how to go on? >> >> Sorry for the long mail, >> >> /C >> >> >> >>  >> >> _______________________________________________ >> Matplotlibusers mailing list >> Matplotlibusers@... >> <mailto:Matplotlibusers@...> >> https://lists.sourceforge.net/lists/listinfo/matplotlibusers >> >> >> >> >>  >> >> >> >> >> _______________________________________________ >> Matplotlibusers mailing list >> Matplotlibusers@... >> https://lists.sourceforge.net/lists/listinfo/matplotlibusers > > >  > > _______________________________________________ > Matplotlibusers mailing list > Matplotlibusers@... > https://lists.sourceforge.net/lists/listinfo/matplotlibusers > 
From: Alan G Isaac <alan.isaac@gm...>  20100520 12:26:38

On 5/18/2010 9:53 AM, Nick Schurch wrote: > Is there anyway of reploting the distribution generated by hist at a > later point? http://docs.scipy.org/doc/numpy/reference/generated/numpy.histogram.html hth, Alan Isaac 