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
(8) |
2
(14) |
3
(22) |
4
(13) |
5
(11) |
6
(12) |
7
(4) |
8
(6) |
9
(19) |
10
(14) |
11
(16) |
12
(6) |
13
(15) |
14
(6) |
15
(8) |
16
(22) |
17
(17) |
18
(8) |
19
(16) |
20
(19) |
21
(3) |
22
(6) |
23
(18) |
24
(26) |
25
(17) |
26
(13) |
27
(18) |
28
(8) |
29
|
30
(14) |
31
(30) |
|
|
|
|
Hello, I was wondering whether there is a way to rotate a grayscale/ colorscale when using imshow. I have been using PGPLOT (a fortran/c plotting library) for many years now, and the equivalent to imshow is called PGGRAY (or PGIMAG). One of the arguments this function takes is a 6-element array TR which is a transformation matrix. From the PGPLOT documentation: "The transformation matrix TR is used to calculate the world coordinates of the center of the "cell" that represents each array element. The world coordinates of the center of the cell corresponding to array element A(I,J) are given by: X = TR(1) + TR(2)*I + TR(3)*J Y = TR(4) + TR(5)*I + TR(6)*J" This is actually the same as the ImageMatrix element in the Postscript language: "ImageMatrix array (Required) An array of six numbers defining a transformation from user space to image space." (http://www.adobe.com/devnet/postscript/pdfs/PLRM.pdf , page 298) This allows arbitrary rotation/translation of the image to plotting without any loss in quality for vector graphics formats (EPS, PDF, SVG). So far, I have found that imshow has an 'extend' keyword, which is the equivalent of four of the matrix elements, but there is no way to specify the rotation. Is there such a feature in matplotlib already? If not, would it be possible to implement it? Just to be clear, I am not talking about rotating with some kind of interpolation, which would degrade the image (this can be done with PIL). What I want is to be able to specify a transformation matrix which includes rotation, which means that there is no resampling done if I save my plot in a vector graphics format. Thanks in advance for any help! Thomas
Timothée Lecomte wrote: > Dear all, > > I am using matplotlib with a great pleasure, and I enjoy its capabilities. > I have recently attended a conference where the invited speaker showed > great visualizations of arrays from both experiments and simulations. > His plots were basically looking like those produced by imshow, that is > a luminance array rendered as a colormap image, but with the additionnal > use of a shading, which gives a really great feeling to the image. You > can feel the height of each part of the image. > > I have tried to find what software could have produced such a plot, and > found the ReliefPlot function of Mathematica, which has precisely this > purpose : rendering a colormap image from an array with a shading to > give the perception of relief. > > The documentation and its examples are self-explanatory : > http://reference.wolfram.com/mathematica/ref/ReliefPlot.html > (look in particular at the first "neat example" at the bottom of that page) > > The two "live" demonstrations illustrate this plot style quite well too : > http://demonstrations.wolfram.com/ReliefShadedElevationMap/ > http://demonstrations.wolfram.com/VoronoiImage/ > > So here are my questions : > Is there a trick to generate an image with such a shading in matplotlib ? > If not, do you know of a python tool that could help ? > Where could I start if I want to code it myself in matplotlib ? > > Thanks for your help. > > Best regards, > > Timothée Lecomte > > Timothée: There is nothing built-in, but it would be a nice thing to have. Here's a proof-of-concept hack that follows the approach used in the Generic Mapping Tools (explained here http://www.seismo.ethz.ch/gmt/doc/html/tutorial/node70.html), with some code borrowed from http://www.langarson.com.au/blog/?p=14. It's very rough, but if it looks promising to you I can try to polish it. -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
James Boyle wrote: > Jeff, > > This is something I have noticed recently. If I set lon_0 = 180. using > the robin projection , the parallels from 0 to 180 are drawn thicker > than those from 180 to 360. > Perhaps the 0 to 180 are drawn twice - with some small offset - due > some wraparound problem. > Enclosed is some code illustrating the problem and the pngs. > It is not a glaring difference, but I think real. It also shows up if > you look carefully at the output from simpletest.py in your examples. > > basemap .99.1 matplotlib 0.98.3 OS X 10.4 > --Jim > > m = basemap.Basemap(resolution='c',projection='robin',lon_0=180.) > parallels = numpy.arange(-90.,90.,30.) > m.drawparallels(parallels,labels=[1,0,0,0],color='r') > pylab.title('lon_0=180') > pylab.savefig('lon_0-180') > pylab.clf() > > m = basemap.Basemap(resolution='c',projection='robin',lon_0=0.) > parallels = numpy.arange(-90.,90.,30.) > m.drawparallels(parallels,labels=[1,0,0,0],color='r') > pylab.title('lon_0=0') > pylab.savefig('lon_0-0') > pylab.clf() > Jim: I can't reproduce this, so I suspect it's been fixed since basemap 0.99.1. Can you upgrade and let me know whether that fixes it for you? -Jeff (P.S. CC'ing matplotlib-users) > ------------------------------------------------------------------------ > > > > ------------------------------------------------------------------------ > -- 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 am using matplotlib's object-oriented API to dynamically generate some graphs served by a web site. The web site is built with Django and I have generally followed the cookbook example I found here: http://www.scipy.org/Cookbook/Matplotlib/Django for serving matplotlib figures under Django. Specifically my code looks like this: from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas from matplotlib.figure import Figure def generate_png(request, f, year, cid, pid, ic): # ...snipped code that generates the data to graph... fig = Figure() ax = fig.add_subplot(111) ax.set_title(fig_title) ax.set_xlabel("Score") ax.set_ylabel("Frequency") n, bins2, patches = ax.hist(vals, bins, facecolor='blue', edgecolor='blue') if x is not None: patches[x].set_facecolor('red') patches[x].set_edgecolor('red') fig.legend((patches[x],), ('%s (%d)' % (cname, cval),), 'lower left') canvas = FigureCanvas(fig) canvas.print_png(f) # ... snip remainder ... This works fine, except when I run it under a multi-threaded web server (Apache with mod_wsgi in daemon mode with multi-threaded processes) it sometimes (not always) fails with this traceback: File "/home/kmt/django/Django-1.1-alpha-1/django/core/handlers/base.py", line 86, in get_response response = callback(request, *callback_args, **callback_kwargs) File "/home/kmt/software/web/xword/acpt/views.py", line 321, in get_png response = generate_png(request, f, year, cid, pid, ic) File "/home/kmt/software/web/xword/acpt/views.py", line 308, in generate_png canvas.print_png(f) File "/usr/lib/python2.5/site-packages/matplotlib/backends/backend_agg.py", line 305, in print_png FigureCanvasAgg.draw(self) File "/usr/lib/python2.5/site-packages/matplotlib/backends/backend_agg.py", line 261, in draw self.figure.draw(self.renderer) File "/usr/lib/python2.5/site-packages/matplotlib/figure.py", line 765, in draw legend.draw(renderer) File "/usr/lib/python2.5/site-packages/matplotlib/legend.py", line 215, in draw t.draw(renderer) File "/usr/lib/python2.5/site-packages/matplotlib/text.py", line 329, in draw ismath=self.is_math_text(line)) File "/usr/lib/python2.5/site-packages/matplotlib/backends/backend_agg.py", line 113, in draw_text self._renderer.draw_text_image(font.get_image(), int(x), int(y) + 1, angle, gc) RuntimeError: You must call .set_text() before .get_image() I'm not at all familiar with the internals (truly I'm barely familiar with the public APIs) of matplotlib but it appears from this exception that internally there's a 'font' object being shared between threads here, such that one thread can come in and change the font state resulting in a subsequent error in a different thread that was also in the middle of using that font object? If I protect that block of code above with a thread lock so that only one thread is allowed in at a time, the problem goes away. For reference I'm using the latest matplotlib available in the Ubuntu Intrepid (8.10) repositories, which looks to be 0.98.3. In a brief scan I didn't see anything relevant listed in the "what's new" page for 0.98.4 (and can't find a "what's new in 0.98.5" on the matplotlib web site though that is what is listed as most recent?). Nor can I find anything that looks similar logged as a bug in the tracker. Is there something (besides bracketing all access to the matplotlib code with a thread mutex) that I should be doing to make my use of matplotlib thread safe or does it seem like there's a multi-threading bug in matplotlib here? Thanks for any pointers, Karen
Dear all, I am using matplotlib with a great pleasure, and I enjoy its capabilities. I have recently attended a conference where the invited speaker showed great visualizations of arrays from both experiments and simulations. His plots were basically looking like those produced by imshow, that is a luminance array rendered as a colormap image, but with the additionnal use of a shading, which gives a really great feeling to the image. You can feel the height of each part of the image. I have tried to find what software could have produced such a plot, and found the ReliefPlot function of Mathematica, which has precisely this purpose : rendering a colormap image from an array with a shading to give the perception of relief. The documentation and its examples are self-explanatory : http://reference.wolfram.com/mathematica/ref/ReliefPlot.html (look in particular at the first "neat example" at the bottom of that page) The two "live" demonstrations illustrate this plot style quite well too : http://demonstrations.wolfram.com/ReliefShadedElevationMap/ http://demonstrations.wolfram.com/VoronoiImage/ So here are my questions : Is there a trick to generate an image with such a shading in matplotlib ? If not, do you know of a python tool that could help ? Where could I start if I want to code it myself in matplotlib ? Thanks for your help. Best regards, Timothée Lecomte -- Laboratoire Pierre Aigrain, École Normale Supérieure 24, rue Lhomond 75005 Paris
Hatch, Sara J wrote: > Jeff, > > My plan was to use the orthographic projection to represent the Moon (hence the 1737.4 km radius) and to plot a spacecraft trajectory around it. If I had read the rsphere documentation past the first half sentence I would have noticed that it was in meters instead of kilometers, sorry about that. Once I implemented this change, the horizontal lines go away. > Sara: OK, great. > Regarding the origin location: I have my spacecraft trajectory calculated with the origin being coincident with the center of the Moon. I can easily translate my coordinates to work with the origin not being the center of the projection, but would it be possible to implement some way to change where the origin is on the projection? > No, sorry - there's no easy way to do that. -Jeff > Thanks, > Sara > > > > -----Original Message----- > From: Jeff Whitaker [mailto:js...@fa...] > Sent: Thursday, March 12, 2009 4:05 PM > To: Hatch, Sara J > Cc: mat...@li... > Subject: Re: [Matplotlib-users] Erroneous Horizontal Lines when Using Basemap > > Hatch, Sara J wrote: > >> Matplotlib Folks, >> >> I tried to use the orthographic projection in the basemap toolkit and >> I'm finding that the parallel lines are not behaving correctly, i.e., >> there are horizontal lines connecting the left and right side of the >> map boundary where a curved latitude line intersects the map boundary. >> I've included a sample script below and a figure illustrating the problem. >> >> import pylab >> >> import mpl_toolkits.basemap as basemap >> >> ortho = >> basemap.Basemap(projection='ortho',lon_0=0,lat_0=50,rsphere=1737.4) >> >> ortho.drawparallels(pylab.arange(-90,90,30)) >> >> ortho.drawmeridians(pylab.arange(0,360,30)) >> >> ortho.drawmapboundary(fill_color='w') >> >> In addition, how do I change the x/y coordinates the center of the >> projection to be (0,0)? With the above code, the center of the >> bounding circle is at (1737.4,1737.4). >> >> Thanks for the help, >> >> Sara >> >> > Sara: If you take out the rsphere=1734.4 (thereby using the default > value of 6370997), the jumpy lines go away. rsphere=1734.4 means assume > the earth is a perfect sphere with a radius of 1734.4 meters. That's an > awfully small earth - I think the jumpy lines are a result of roundoff > errors in the map projection calculation for very small spheres. Still, > that shouldn't happen, so I will look into it. > > Regarding the x/y coordinate of the middle of the plot - Basemap assigns > the lower left corner of the map projection region an x/y value of 0,0 > for most map projections. > > -Jeff > >
Hatch, Sara J wrote: > > Matplotlib Folks, > > I tried to use the orthographic projection in the basemap toolkit and > I’m finding that the parallel lines are not behaving correctly, i.e., > there are horizontal lines connecting the left and right side of the > map boundary where a curved latitude line intersects the map boundary. > I’ve included a sample script below and a figure illustrating the problem. > > import pylab > > import mpl_toolkits.basemap as basemap > > ortho = > basemap.Basemap(projection='ortho',lon_0=0,lat_0=50,rsphere=1737.4) > > ortho.drawparallels(pylab.arange(-90,90,30)) > > ortho.drawmeridians(pylab.arange(0,360,30)) > > ortho.drawmapboundary(fill_color='w') > > In addition, how do I change the x/y coordinates the center of the > projection to be (0,0)? With the above code, the center of the > bounding circle is at (1737.4,1737.4). > > Thanks for the help, > > Sara > Sara: If you take out the rsphere=1734.4 (thereby using the default value of 6370997), the jumpy lines go away. rsphere=1734.4 means assume the earth is a perfect sphere with a radius of 1734.4 meters. That's an awfully small earth - I think the jumpy lines are a result of roundoff errors in the map projection calculation for very small spheres. Still, that shouldn't happen, so I will look into it. Regarding the x/y coordinate of the middle of the plot - Basemap assigns the lower left corner of the map projection region an x/y value of 0,0 for most map projections. -Jeff
Voila, This was what I have been looking for exactly. Thanks for the solution. PS: I have edited the related wiki page reflecting this method, as well: http://www.scipy.org/Cookbook/Matplotlib/Multiple_Subplots_with_One_Axis_Label Gökhan On Thu, Mar 12, 2009 at 10:28 AM, Sebastian Krieger <seb...@io...>wrote: > I think now I got what you want. Simply put the label on the middle > subplot. If it's too big it will span accross the other plots. > > import pylab > > figprops = dict(figsize=(8., 8. / 1.618), > dpi=128) # Figure properties > adjustprops = dict(left=0.1, bottom=0.1, right=0.97, top=0.93, wspace=0.2, > > hspace=0.2) # Subplot > properties > > fig = > pylab.figure(**figprops) # > New figure > fig.subplots_adjust(**adjustprops) > # Tunes the subplot layout > > ax = fig.add_subplot(3, 1, 1) > bx = fig.add_subplot(3, 1, 2, sharex=ax, sharey=ax) > cx = fig.add_subplot(3, 1, 3, sharex=ax, sharey=ax) > > pylab.setp(ax.get_xticklabels(), visible=False) > pylab.setp(bx.get_xticklabels(), visible=False) > > bx.set_ylabel('This is a long label shared among more axes', fontsize=14) > cx.set_xlabel('And a shared x label', fontsize=14) > > Cheers, > Sebastian > > Gökhan SEVER wrote: > > Hello Sebastian, > > Not sure I could create a same-axes ylabels subplots similar to the one > that is shown on the given screenshot with your code. ( > http://img11.imageshack.us/img11/8793/subplots.png) > > Sorry haven't managed to make LateX work on my matplotlib outputs :( > > Thanks for your time and consideration. > > Gökhan > >
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta content="text/html;charset=UTF-8" http-equiv="Content-Type"> </head> <body bgcolor="#ffffff" text="#000000"> I think now I got what you want. Simply put the label on the middle subplot. If it's too big it will span accross the other plots.<br> <blockquote><tt>import pylab</tt><br> <br> <tt>figprops = dict(figsize=(8., 8. / 1.618), dpi=128) # Figure properties</tt><br> <tt>adjustprops = dict(left=0.1, bottom=0.1, right=0.97, top=0.93, wspace=0.2,</tt><br> <tt> hspace=0.2) # Subplot properties</tt><br> <br> <tt>fig = pylab.figure(**figprops) # New figure</tt><br> <tt>fig.subplots_adjust(**adjustprops) # Tunes the subplot layout</tt><br> <br> <tt>ax = fig.add_subplot(3, 1, 1)</tt><br> <tt>bx = fig.add_subplot(3, 1, 2, sharex=ax, sharey=ax)</tt><br> <tt>cx = fig.add_subplot(3, 1, 3, sharex=ax, sharey=ax)</tt><br> <br> <tt>pylab.setp(ax.get_xticklabels(), visible=False)</tt><br> <tt>pylab.setp(bx.get_xticklabels(), visible=False)</tt><br> <br> <tt>bx.set_ylabel('This is a long label shared among more axes', fontsize=14)</tt><br> <tt>cx.set_xlabel('And a shared x label', fontsize=14)</tt><br> </blockquote> Cheers,<br> Sebastian<br> <br> Gökhan SEVER wrote: <blockquote cite="mid:49d...@ma..." type="cite">Hello Sebastian,<br> <br> Not sure I could create a same-axes ylabels subplots similar to the one that is shown on the given screenshot with your code. (<a moz-do-not-send="true" href="http://img11.imageshack.us/img11/8793/subplots.png">http://img11.imageshack.us/img11/8793/subplots.png</a>)<br> <br> Sorry haven't managed to make LateX work on my matplotlib outputs :(<br> <br> Thanks for your time and consideration.<br> <br> Gökhan<br> </blockquote> </body> </html>
Hello Sebastian, Not sure I could create a same-axes ylabels subplots similar to the one that is shown on the given screenshot with your code. ( http://img11.imageshack.us/img11/8793/subplots.png) Sorry haven't managed to make LateX work on my matplotlib outputs :( Thanks for your time and consideration. Gökhan On Wed, Mar 11, 2009 at 8:49 AM, Sebastian Krieger <seb...@io...>wrote: > Hi Gökhan et al, > > I hope the following code might help you out and show you the basic idea of > sharing the same x and y axis over several subplots. I've made a plot with 2 > x 2 subplots sharing both x and y axis and showing only the labels at the > left and the labels at the bottom. > > import pylab > > figprops = dict(figsize=(8., 8. / 1.618), > dpi=128) # Figure properties > adjustprops = dict(left=0.1, bottom=0.1, right=0.97, top=0.93, wspace=0.08, > > hspace=0.1) # Subplot > properties > > fig = > pylab.figure(**figprops) # > New figure > fig.subplots_adjust(**adjustprops) > # Tunes the subplot layout > > ax = fig.add_subplot(2, 2, 1) > bx = fig.add_subplot(2, 2, 2, sharex=ax, sharey=ax) > cx = fig.add_subplot(2, 2, 3, sharex=ax, sharey=ax) > dx = fig.add_subplot(2, 2, 4, sharex=ax, sharey=ax) > > ax.plot(X1, Y1, 'k-') > bx.plot(X2, Y2, 'k-') > cx.plot(X3, Y3, 'k-') > dx.plot(X4, Y4, 'k-') > > pylab.setp(ax.get_xticklabels(), visible=False) > pylab.setp(bx.get_xticklabels(), visible=False) > pylab.setp(bx.get_yticklabels(), visible=False) > pylab.setp(dx.get_yticklabels(), visible=False) > > You can make the subplots come closer by changing the *wspace* and *hspace > * entries in the *adjustprops* dictionary. > > Cheers, > Sebastian > > > Gökhan SEVER wrote: > > I don't know how to do this in matplotlib. Can you give an example? > > Chip, > > I tried your method but didn't work for me :( > > So far, my best approach is use some GIMP tricks on transparent canvas. > With these improvements I am finishing my first official poster. > > Thanks. > Gökhan > >
hi all, is there a way to plot the results of hierarchical clustering as a dendrogram on top and to the sides of a heatmap matrix? for example, like this figure: http://www.egms.de/figures/meetings/gmds2006/06gmds075.f1.png any examples of how to do this in matplotlib would be greatly appreciated. thank you.
It can be tricky to give you a correct answer without knowing what version of mpl you're using. The legend for the scatter plot has been added rather recently so my answer below may not work for you. Anyhow, this seems to be a bug in the documentation, not the code. The legend for scatter plot has its own properties to control the number of points, which is "scatterpoints". So, try legend(scatterpoints=1) As a side note, > legend('my point', numpoints=1) The first argument should be a list, but I guess this could be just a typo. > scatter([1,2,3],[1,2,3], label="_nolegend_") You'd better not use this (setting the label) if you're explicitly giving the legend labels. I recommend you to stick with either scatter([1,2,3],[1,2,3], label="_nolegend_") scatter([1],[1],c='r', label="mypoints") legend(scatterpoints=1) or s1=scatter([1,2,3],[1,2,3]) s2=scatter([1],[1],c='r') legend([s2], ["mypoints"], scatterpoints=1) -JJ On Wed, Mar 11, 2009 at 6:39 PM, per freem <per...@gm...> wrote: > hi all, > > following my last post, i found what seems to me to be a bug in the legend > handling of scatter plots. suppose i have: > > scatter([1,2,3],[1,2,3], label="_nolegend_") > > i then want to color some subset of these points in a different color, or > plot them using a different marker size, etc. so i do: > > scatter([1],[1],c='r') > > then if i do: > > legend('my point', numpoints=1) > > the legend is still displayed with 3 points... even if i directly set > rcParams['legend.numpoints'] = 1, it still behaves this way. any idea how to > fix this? > > thank you > > ------------------------------------------------------------------------------ > Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are > powering Web 2.0 with engaging, cross-platform capabilities. Quickly and > easily build your RIAs with Flex Builder, the Eclipse(TM)based development > software that enables intelligent coding and step-through debugging. > Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > >
hi all, following my last post, i found what seems to me to be a bug in the legend handling of scatter plots. suppose i have: scatter([1,2,3],[1,2,3], label="_nolegend_") i then want to color some subset of these points in a different color, or plot them using a different marker size, etc. so i do: scatter([1],[1],c='r') then if i do: legend('my point', numpoints=1) the legend is still displayed with 3 points... even if i directly set rcParams['legend.numpoints'] = 1, it still behaves this way. any idea how to fix this? thank you
hi all, i'm plotting a scatter plot with several kinds of markers and would like to display a legend for them. if i try the following: scatter([1,2,3],[1,2,3]) legend('a') then the legend shows three dots (of the same type used in the scatter plot) in this strange arc configuration, with the label 'a' next to it. how can i make it so it just displays a single dot instead? also, is there a way to make the legend display outside the figure? thanks
On Wed, Mar 11, 2009 at 9:36 PM, Laurent Dufrechou <lau...@fr...> wrote: > Hey pierre, > Wow that's fantastic! Indeed it is, at least judging by screenshots ;-). > > Wow I had seen your pyqtshell I was really impressed by all the surrounding > widgets. > Wow ;) > > Good job! :) Now that you are all excited Laurent, perhaps you (with your prev. experience) could take it for a small spin to see how we can shoehorn ipython into it ;-) It's good to see this progressing - I wrote my ipython qt shell in order to see how easily that stuff could be done (cut all corners, make sqintilla do the colorization, etc). This version clearly has more of the all-important polishing work done. -- Ville M. Vainio http://tinyurl.com/vainio
Try aa.set_autoscale_on(False) before your "make_xaxis" call (but after xlim and ylim changed). When you plot something, the xlim and ylim is automatically adjusted (unless you set autoscale=False). -JJ On Wed, Mar 11, 2009 at 2:31 PM, Nicholas Stephens <Nic...@un...> wrote: > Hi all, > > I am again a little defeated so I hope somebody can point me in the > right direction. I am trying to plot a graph but require some > customation of the axes afterwards. As the axes are sacred in > matplotlib I am trying to hide the existing axes and plot some new > axes afterwards. The problem I have encountered is whilst plotting the > new axes, the xlim functions apparently are no longer recognised. > > The new axes appears fine but on the non-limited axes. All of this > appears to work until the "make_xaxis" command where the original > non-limited x axis appears again. I have tried various methods, tricks > and suggestions but cannot appear to get the script to work. Probably > something simple I know, but I can't seem to get around this one :-s > > > test script > > > from pylab import * > import matplotlib.pyplot as plt > import matplotlib.lines as lines > > #define new axis subroutines > def make_xaxis(aa, yloc, offset, **props): > xmin, xmax = aa.get_xlim() > locs = [loc for loc in aa.xaxis.get_majorticklocs() > if loc>=xmin and loc<=xmax] > tickline, = aa.plot(locs, [yloc]*len(locs),linestyle='', > marker=lines.TICKDOWN, **props) > aaline, = aa.plot([xmin, xmax], [yloc, yloc], **props) > tickline.set_clip_on(False) > aaline.set_clip_on(False) > # xaxis text > for loc in locs: > aa.text(loc, yloc-offset, '%1.0f'%loc, > horizontalalignment='center', > verticalalignment='top') > > def make_yaxis(aa, xloc, offset, **props): > ymin, ymax = aa.get_ylim() > locs = [loc for loc in aa.yaxis.get_majorticklocs() > if loc>=ymin and loc<=ymax] > tickline, = aa.plot([xloc]*len(locs), locs, linestyle='', > marker=lines.TICKLEFT, **props) > aaline, = aa.plot([xloc, xloc], [ymin, ymax], **props) > tickline.set_clip_on(False) > aaline.set_clip_on(False) > # yaxis text > for loc in locs: > aa.text(xloc-offset, loc, '%1.2f'%loc, > verticalalignment='center', > horizontalalignment='right') > > #read data > a=load('NC_figure4_alteredT.dat', skiprows=(1)) > ax=a[:,0] > ay1=a[:,1] > ay2=a[:,2] > > props = dict(color='black', linewidth=2, markeredgewidth=2) > #new axis props > fig = plt.figure(facecolor='white') > aa = fig.add_subplot(111, frame_on=False) > aa.scatter(ax, ay2, s=15, c='b', marker='^') > aa.set_xlim(-2.5,58.5) > aa.set_ylim(-0.01,0.25) > > #plot new axes > make_xaxis(aa, -0.02, offset=0.01, **props) > #offset text values from axes > #select y axis intercept > #make_yaxis(aa, -4, offset=3, **props) #offset text values from axes > > show() > > > > data> > time (h) n:c (a) n:c (b) > -2 0.12 0.21 > -2 0.12 0.15 > -2 0.1 0.14 > 0 0.12 0.14 > 0 0.11 0.13 > 0 0.11 0.21 > 2 0.11 0.15 > 2 0.11 0.13 > 2 0.11 0.14 > 4 0.11 0.14 > 4 0.1 0.14 > 4 0.09 0.12 > 6 0.09 0.14 > 6 0.1 0.12 > 6 0.1 0.1 > 8 0.11 0.13 > 8 0.08 0.13 > 8 0.1 0.11 > 10 0.1 0.12 > 10 0.08 0.11 > 10 0.11 0.1 > 12 0.07 0.1 > 12 0.09 0.1 > 12 0.08 0.1 > 14 0.1 0.1 > 14 0.16 0.1 > 14 0.1 0.1 > 16 0.1 0.1 > 16 0.17 0.1 > 16 0.07 0.1 > 18 0.1 0.09 > 18 0.09 0.11 > 18 0.09 0.11 > 20 0.09 0.12 > 20 0.09 0.1 > 20 0.07 0.11 > 22 0.12 0.11 > 22 0.09 0.12 > 22 0.09 0.13 > 24 0.09 0.13 > 24 0.11 0.13 > 24 0.11 0.13 > 26 0.09 0.12 > 26 0.09 0.13 > 26 0.11 0.14 > 28 0.09 0.13 > 28 0.1 0.14 > 28 0.09 0.13 > 30 0.09 0.12 > 30 0.1 0.13 > 30 0.1 0.12 > 32 0.09 0.12 > 32 0.08 0.12 > 32 0.09 0.12 > 34 0.08 0.12 > 34 0.08 0.12 > 34 0.11 0.11 > 36 0.09 0.11 > 36 0.07 0.11 > 36 0.09 0.1 > 38 0.1 0.11 > 38 0.08 0.11 > 38 0.09 0.1 > 40 0.09 0.11 > 40 0.09 0.11 > 40 0.09 0.11 > 42 0.09 0.11 > 42 0.11 0.12 > 42 0.08 0.11 > 44 0.12 0.12 > 44 0.12 0.16 > 44 0.11 0.12 > 46 0.11 0.12 > 46 0.12 0.11 > 46 0.1 0.12 > 48 0.1 0.12 > 48 0.14 0.13 > 48 0.1 0.14 > 56 0.1 0.12 > 56 0.11 0.12 > 56 0.11 0.12 > 58 0.12 0.11 > 58 0.12 0.11 > 58 0.12 0.1 > > > > > ------------------------------------------------------------------------------ > Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are > powering Web 2.0 with engaging, cross-platform capabilities. Quickly and > easily build your RIAs with Flex Builder, the Eclipse(TM)based development > software that enables intelligent coding and step-through debugging. > Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users >
I need to save a figure for importing into another application. I wrote a module which creates a plot and then calls savefig to save the figure as a .jpg. This works fine when I run the applicaiton stand alone, but when I try to save a figure from another file (which happens to use wx), it can't save as a .jpg (unknown file type). I believe this has to do with the backend being used (I think running stand alone it is using GTKapp). Is there a way to "force" this object to use a specific backend so I can use the .jpg file type?
Hey pierre, Wow that's fantastic! One week ago I started (not sent) a mail that was intended for you on python(x,y) I explained that the main issue I get with users I want to convert to python is: 1) "Hey there is so lot packages, each time I need to install a new package to get your feature." 2) "Python is bad for my dumb users, scilab is better, when they double click on the .sce it open the script, they edit the parameters in the script file and run the script clicking on run." Python(x,y) solved point 1. Pydee could solve point 2! Perhaps I will be able to trash these ###### install of scilab! Have you planed to integrate it into python(x,y)? If yes, an excellent idea could be to be able to create file extension like .pyp that are python script but that open Pydee! Wow I had seen your pyqtshell I was really impressed by all the surrounding widgets. Wow ;) Good job! :)
Hi all, I am again a little defeated so I hope somebody can point me in the right direction. I am trying to plot a graph but require some customation of the axes afterwards. As the axes are sacred in matplotlib I am trying to hide the existing axes and plot some new axes afterwards. The problem I have encountered is whilst plotting the new axes, the xlim functions apparently are no longer recognised. The new axes appears fine but on the non-limited axes. All of this appears to work until the "make_xaxis" command where the original non-limited x axis appears again. I have tried various methods, tricks and suggestions but cannot appear to get the script to work. Probably something simple I know, but I can't seem to get around this one :-s test script > from pylab import * import matplotlib.pyplot as plt import matplotlib.lines as lines #define new axis subroutines def make_xaxis(aa, yloc, offset, **props): xmin, xmax = aa.get_xlim() locs = [loc for loc in aa.xaxis.get_majorticklocs() if loc>=xmin and loc<=xmax] tickline, = aa.plot(locs, [yloc]*len(locs),linestyle='', marker=lines.TICKDOWN, **props) aaline, = aa.plot([xmin, xmax], [yloc, yloc], **props) tickline.set_clip_on(False) aaline.set_clip_on(False) # xaxis text for loc in locs: aa.text(loc, yloc-offset, '%1.0f'%loc, horizontalalignment='center', verticalalignment='top') def make_yaxis(aa, xloc, offset, **props): ymin, ymax = aa.get_ylim() locs = [loc for loc in aa.yaxis.get_majorticklocs() if loc>=ymin and loc<=ymax] tickline, = aa.plot([xloc]*len(locs), locs, linestyle='', marker=lines.TICKLEFT, **props) aaline, = aa.plot([xloc, xloc], [ymin, ymax], **props) tickline.set_clip_on(False) aaline.set_clip_on(False) # yaxis text for loc in locs: aa.text(xloc-offset, loc, '%1.2f'%loc, verticalalignment='center', horizontalalignment='right') #read data a=load('NC_figure4_alteredT.dat', skiprows=(1)) ax=a[:,0] ay1=a[:,1] ay2=a[:,2] props = dict(color='black', linewidth=2, markeredgewidth=2) #new axis props fig = plt.figure(facecolor='white') aa = fig.add_subplot(111, frame_on=False) aa.scatter(ax, ay2, s=15, c='b', marker='^') aa.set_xlim(-2.5,58.5) aa.set_ylim(-0.01,0.25) #plot new axes make_xaxis(aa, -0.02, offset=0.01, **props) #offset text values from axes #select y axis intercept #make_yaxis(aa, -4, offset=3, **props) #offset text values from axes show() data> time (h) n:c (a) n:c (b) -2 0.12 0.21 -2 0.12 0.15 -2 0.1 0.14 0 0.12 0.14 0 0.11 0.13 0 0.11 0.21 2 0.11 0.15 2 0.11 0.13 2 0.11 0.14 4 0.11 0.14 4 0.1 0.14 4 0.09 0.12 6 0.09 0.14 6 0.1 0.12 6 0.1 0.1 8 0.11 0.13 8 0.08 0.13 8 0.1 0.11 10 0.1 0.12 10 0.08 0.11 10 0.11 0.1 12 0.07 0.1 12 0.09 0.1 12 0.08 0.1 14 0.1 0.1 14 0.16 0.1 14 0.1 0.1 16 0.1 0.1 16 0.17 0.1 16 0.07 0.1 18 0.1 0.09 18 0.09 0.11 18 0.09 0.11 20 0.09 0.12 20 0.09 0.1 20 0.07 0.11 22 0.12 0.11 22 0.09 0.12 22 0.09 0.13 24 0.09 0.13 24 0.11 0.13 24 0.11 0.13 26 0.09 0.12 26 0.09 0.13 26 0.11 0.14 28 0.09 0.13 28 0.1 0.14 28 0.09 0.13 30 0.09 0.12 30 0.1 0.13 30 0.1 0.12 32 0.09 0.12 32 0.08 0.12 32 0.09 0.12 34 0.08 0.12 34 0.08 0.12 34 0.11 0.11 36 0.09 0.11 36 0.07 0.11 36 0.09 0.1 38 0.1 0.11 38 0.08 0.11 38 0.09 0.1 40 0.09 0.11 40 0.09 0.11 40 0.09 0.11 42 0.09 0.11 42 0.11 0.12 42 0.08 0.11 44 0.12 0.12 44 0.12 0.16 44 0.11 0.12 46 0.11 0.12 46 0.12 0.11 46 0.1 0.12 48 0.1 0.12 48 0.14 0.13 48 0.1 0.14 56 0.1 0.12 56 0.11 0.12 56 0.11 0.12 58 0.12 0.11 58 0.12 0.11 58 0.12 0.1
Jouni K. Seppänen skrev: > Jörgen Stenarson <jor...@bo...> writes: > >> I have been unable to get the pdf backend to respect the settings for >> solid_joinstyle properly. > > Fixed on the trunk; the test case is examples/api/joinstyle.py. Thanks > for your report! > Thanks for the quick fix. It works fine for me now. /Jörgen
Hi: I have a multithread program. One of the thread is using MPL to plot some data. Everything works as expected, until the moment I terminate the program. When the main thread terminate, I start getting this message: Exception exceptions.RuntimeError: RuntimeError('main thread is not in main loop',) in <bound method PhotoImage.__del__ of <Tkinter.PhotoImage instance at 0x910064c>> ignored I get 8 of this message, and then the program finally stop. I am stopping the thread before terminating. I also close the figure. All the threads are running as Daemons (thread_instance.setDaemon(True) ). Any idea about what could be happening? Regards, Alejandro.
Hi Gökhan et al, I hope the following code might help you out and show you the basic idea of sharing the same x and y axis over several subplots. I've made a plot with 2 x 2 subplots sharing both x and y axis and showing only the labels at the left and the labels at the bottom. import pylab figprops = dict(figsize=(8., 8. / 1.618), dpi=128) # Figure properties adjustprops = dict(left=0.1, bottom=0.1, right=0.97, top=0.93, wspace=0.08, hspace=0.1) # Subplot properties fig = pylab.figure(**figprops) # New figure fig.subplots_adjust(**adjustprops) # Tunes the subplot layout ax = fig.add_subplot(2, 2, 1) bx = fig.add_subplot(2, 2, 2, sharex=ax, sharey=ax) cx = fig.add_subplot(2, 2, 3, sharex=ax, sharey=ax) dx = fig.add_subplot(2, 2, 4, sharex=ax, sharey=ax) ax.plot(X1, Y1, 'k-') bx.plot(X2, Y2, 'k-') cx.plot(X3, Y3, 'k-') dx.plot(X4, Y4, 'k-') pylab.setp(ax.get_xticklabels(), visible=False) pylab.setp(bx.get_xticklabels(), visible=False) pylab.setp(bx.get_yticklabels(), visible=False) pylab.setp(dx.get_yticklabels(), visible=False) You can make the subplots come closer by changing the /wspace/ and /hspace/ entries in the /adjustprops/ dictionary. Cheers, Sebastian Gökhan SEVER wrote: > I don't know how to do this in matplotlib. Can you give an example? > > Chip, > > I tried your method but didn't work for me :( > > So far, my best approach is use some GIMP tricks on transparent > canvas. With these improvements I am finishing my first official poster. > > Thanks. > Gökhan
----------------------------------------------------- Edit: Apparently, there's a bug (a what?!) in Pydee v0.3.0 You won't be able to install it and test it until v0.3.1 (I'll release it in 10-12 hours) Sorry for that ----------------------------------------------------- Hi all, Two months ago, I made an announcement regarding a little open-source project of mine, PyQtShell -- that is a module providing embeddable console widgets for your PyQt applications (interactive Python shell, workspace, working directory browser, editor, ...) as well as "Pydee", a PYthon Development EnvironmEnt based on these widgets (which could become an interesting alternative to IDLE for example). Pydee features have been greatly enhanced these last weeks, and a lot of bugs were fixed thanks to Christopher Brown (thank you again Christopher for your bug reports/feature requests which are always very detailed and constructive). I recently (a few minutes ago actually..) added an interesting feature in Pydee v0.3.0: matplotlib integration (i.e. matplotlib figures can be docked inside Pydee which is quite convenient). See this screenshot for example: http://source.pythonxy.com/PyQtShell/screenshots/ss3.png Other screenshots and informations: http://pypi.python.org/pypi/PyQtShell/ http://code.google.com/p/pyqtshell/ As some of you may have noticed, Pydee is intended to be a mini-MATLAB environment -- that being said, it still at an early stage of development. Cheers, Pierre
Gökhan SEVER wrote: > I don't know how to do this in matplotlib. Can you give an example? > > Chip, > > I tried your method but didn't work for me :( Well, I'm using matplotlib 0.98.5.2, I'm not sure if that makes a difference or not. Here's what I'm seeing: http://yfrog.com/090366p It's pretty rough, but I thought it might give you an idea or two. Like I said, I've been meaning to clean up my subplots too I just haven't had time to do it. I'd be curious to see how you do it if you get it working :) -Chip I'm pasting the source again in case I fumbled the last attempt: #!/usr/bin/env python # Make one axis that spans several subplots from matplotlib import pyplot as plt t = [0,1] y = [0,1] fig = plt.figure() plt.axes([0.1,0.1,0.8,0.8], frameon=True, axisbg='w') ax = fig.add_subplot(211) plt.setp(ax.get_yticklabels(), visible=False) plt.plot(t,y) ax = fig.add_subplot(212) plt.setp(ax.get_yticklabels(), visible=False) plt.plot(t,y) plt.show() > > So far, my best approach is use some GIMP tricks on transparent canvas. > With these improvements I am finishing my first official poster. > > Thanks. > Gökhan > > > On Tue, Mar 10, 2009 at 6:01 PM, Jonathan Taylor > <jon...@ut... <mailto:jon...@ut...>> > wrote: > > I don't know if there is a betteer way to do it, but I think you can > just attach a text artist to the figures canvas. > > Best, > J. > > On Mon, Mar 9, 2009 at 12:15 PM, Gökhan SEVER > <gok...@gm... <mailto:gok...@gm...>> wrote: > > Hello, > > > > I have six subplots in my canvas, and wondering how to place > a common ylabel > > into the canvas in matplotlib? (Let say instead of having six > same text on > > the y-axes just to replace them with one bigger text > encompassing all six > > y-axes.) > > > > Is this available in ml or am I too blind to see this feature? > > > > Thanks, > > > > Gökhan > > > > > > > ------------------------------------------------------------------------------ > > Open Source Business Conference (OSBC), March 24-25, 2009, > San Francisco, CA > > -OSBC tackles the biggest issue in open source: Open Sourcing > the Enterprise > > -Strategies to boost innovation and cut costs with open > source participation > > -Receive a 600ドル discount off the registration fee with the > source code: SFAD > > http://p.sf.net/sfu/XcvMzF8H > > _______________________________________________ > > Matplotlib-users mailing list > > Mat...@li... > <mailto:Mat...@li...> > > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > > > > > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------------ > Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are > powering Web 2.0 with engaging, cross-platform capabilities. Quickly and > easily build your RIAs with Flex Builder, the Eclipse(TM)based development > software that enables intelligent coding and step-through debugging. > Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com > > > ------------------------------------------------------------------------ > > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
I don't know how to do this in matplotlib. Can you give an example? Chip, I tried your method but didn't work for me :( So far, my best approach is use some GIMP tricks on transparent canvas. With these improvements I am finishing my first official poster. Thanks. Gökhan > On Tue, Mar 10, 2009 at 6:01 PM, Jonathan Taylor < > jon...@ut...> wrote: > >> I don't know if there is a betteer way to do it, but I think you can >> just attach a text artist to the figures canvas. >> >> Best, >> J. >> >> On Mon, Mar 9, 2009 at 12:15 PM, Gökhan SEVER <gok...@gm...> >> wrote: >> > Hello, >> > >> > I have six subplots in my canvas, and wondering how to place a common >> ylabel >> > into the canvas in matplotlib? (Let say instead of having six same text >> on >> > the y-axes just to replace them with one bigger text encompassing all >> six >> > y-axes.) >> > >> > Is this available in ml or am I too blind to see this feature? >> > >> > Thanks, >> > >> > Gökhan >> > >> > >> > >> ------------------------------------------------------------------------------ >> > Open Source Business Conference (OSBC), March 24-25, 2009, San >> Francisco, CA >> > -OSBC tackles the biggest issue in open source: Open Sourcing the >> Enterprise >> > -Strategies to boost innovation and cut costs with open source >> participation >> > -Receive a 600ドル discount off the registration fee with the source code: >> SFAD >> > http://p.sf.net/sfu/XcvMzF8H >> > _______________________________________________ >> > Matplotlib-users mailing list >> > Mat...@li... >> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> > >> > >> > >