|
From: Zane S. <za...@id...> - 2008-10-09 03:15:23
|
I'm plotting a bunch of lines on a map. They're being colored according to the value of an attribute associated with the objects they represent, using a colormap. However, I also need to create a colorbar to act as a legend, describing what the colors of the lines means, in terms of values associated with that attribute. What's the easiest way to do that? I know what the upper and lower bounds of the values that need to be represented in the colorbar are, but I don't see any way to just slap a generic colorbar on the figure and give it some tick marks corresponding to the values I know the colors represent. I have a list of all the Line2D objects in the map, but I can't pass them to colorbar() as the 'mappable' parameter without getting: AttributeError: 'Line2D' object has no attribute 'autoscale_None' It seems like this is something that should be trivially easy, but I don't see how to do it in the documentation anywhere. Thanks for any insight you might have... Zane -- Zane Selvans Amateur Earthling za...@id... 303/815-6866 http://zaneselvans.org PGP Key: 55E0815F |
|
From: Zane S. <za...@id...> - 2008-10-09 07:45:18
|
Zane Selvans <zane@...> writes: > > I'm plotting a bunch of lines on a map. They're being colored > according to the value of an attribute associated with the objects > they represent, using a colormap. However, I also need to create a > colorbar to act as a legend, describing what the colors of the lines > means, in terms of values associated with that attribute. > > What's the easiest way to do that? I've found the matplotlib.colorbar.ColorbarBase class... and have been able to use matplotlib.colorbar.make_axes() to create a somewhat acceptable set of axes into which I can put a colorbar constructed from the same colormap that I'm using to color the lines I'm plotting. However, I can't seem to get the tics and axes on the colorbar to correspond to the values associated with the colors - they only ever go from 0-1. I want them to go from, for instance, 0-180 (degrees) in 20 or 30 degree intervals. It seemed like setting the keyword arguments in ColorbarBase(boundaries=[0,180]) or values=linspace(0,180,10) or something like that ought to have done the right thing... but no, and I don't see any documentation on how these keywords are supposed to be used, in the docstring or elsewhere... anyone know how they work? |
|
From: John H. <jd...@gm...> - 2008-10-14 11:18:42
|
On Mon, Oct 13, 2008 at 6:56 PM, Eric Firing <ef...@ha...> wrote: >> However, unfortunately there appears to be some problem with the >> generation of the figures which are supposed to be embedded within that >> documentation - they're all appearing as nothing but blank white spaces, >> both in Firefox 3.0.3 on OS X 10.5.5, and when I download the files and view >> them with other programs. Do other people see this problem? > > Yes, something is broken. I don't know how to fix it, though. It looks like either the rsync screwed up or sf is throttling us or both. I got this message in my cron job ssh: connect to host matplotlib.sf.net port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(453) [sender=2.6.9] ssh: connect to host matplotlib.sf.net port 22: Connection refused lost connection when I check the images in the http://matplotlib.sourceforge.net/doc/html/pyplots/ directory, they are there but are smaller in filesize than they are in the directory on the build machine, suggesting they were truncated in the transfer. When I try and log into the sf shell server > ssh -l jdh2358 shell.sf.net it hangs. Normally they send me an email when I am over file size quota, so I would be surprised if they simply throttled us w/o a warning, but I will file a ticket with the sf folks and see if they can help. JDH |
|
From: Ryan M. <rm...@gm...> - 2008-10-09 14:08:53
|
Zane Selvans wrote: > Zane Selvans <zane@...> writes: > >> I'm plotting a bunch of lines on a map. They're being colored >> according to the value of an attribute associated with the objects >> they represent, using a colormap. However, I also need to create a >> colorbar to act as a legend, describing what the colors of the lines >> means, in terms of values associated with that attribute. >> >> What's the easiest way to do that? > > I've found the matplotlib.colorbar.ColorbarBase class... and have been able to > use matplotlib.colorbar.make_axes() to create a somewhat acceptable set of axes > into which I can put a colorbar constructed from the same colormap that I'm > using to color the lines I'm plotting. However, I can't seem to get the tics > and axes on the colorbar to correspond to the values associated with the colors > - they only ever go from 0-1. I want them to go from, for instance, 0-180 > (degrees) in 20 or 30 degree intervals. It seemed like setting the keyword > arguments in ColorbarBase(boundaries=[0,180]) or values=linspace(0,180,10) or > something like that ought to have done the right thing... but no, and I don't > see any documentation on how these keywords are supposed to be used, in the > docstring or elsewhere... anyone know how they work? You need to pass an instance of a matplotlib.colors.Normalize to the constructure to ColorbarBase, as in: cbar = ColorbarBase(norm=Normalize(0, 180)) As far as colormapping lines, you can do this using a LineCollection object. Hope this helps, Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma |
|
From: Zane S. <za...@id...> - 2008-10-09 19:40:50
|
On Oct 9, 2008, at 7:08 AM, Ryan May wrote: > Zane Selvans wrote: >> Zane Selvans <zane@...> writes: >> >>> I also need to create a >>> colorbar to act as a legend, describing what the colors of the lines >>> means, in terms of values associated with that attribute. >> >> I've found the matplotlib.colorbar.ColorbarBase class... >> I want them to go from, for instance, 0-180 >> (degrees) in 20 or 30 degree intervals. It seemed like setting the >> keyword >> arguments in ColorbarBase(boundaries=[0,180]) or >> values=linspace(0,180,10) or >> something like that ought to have done the right thing... but no, >> and I don't >> see any documentation on how these keywords are supposed to be >> used, in the >> docstring or elsewhere... anyone know how they work? > > You need to pass an instance of a matplotlib.colors.Normalize to the > constructure to ColorbarBase, as in: > > cbar = ColorbarBase(norm=Normalize(0, 180)) Ahhh. There we go. > As far as colormapping lines, you can do this using a LineCollection > object. Hmm. I'll have a look at these. Jeff Whitaker suggested them for something else too. I too often feel like I'm just hacking my way around in Matplotlib, without understanding how it is actually "supposed" to be used (i.e. how it was designed to work). Is there an architectural overview floating around somewhere that I'm not aware of? Thanks for the help! Zane -- Zane Selvans Amateur Earthling za...@id... 303/815-6866 http://zaneselvans.org PGP Key: 55E0815F |
|
From: John H. <jd...@gm...> - 2008-10-09 19:56:01
|
On Thu, Oct 9, 2008 at 2:40 PM, Zane Selvans <za...@id...> wrote: > Hmm. I'll have a look at these. Jeff Whitaker suggested them for > something else too. I too often feel like I'm just hacking my way > around in Matplotlib, without understanding how it is actually > "supposed" to be used (i.e. how it was designed to work). Is there an > architectural overview floating around somewhere that I'm not aware of? Check out http://matplotlib.sourceforge.net/doc/html/users/artists.html and other docs at http://matplotlib.sourceforge.net/doc/html/index.html |
|
From: Zane S. <za...@id...> - 2008-10-13 23:39:05
|
On Oct 9, 2008, at 12:55 PM, John Hunter wrote: > On Thu, Oct 9, 2008 at 2:40 PM, Zane Selvans <za...@id...> > wrote: > >> I too often feel like I'm just hacking my way >> around in Matplotlib, without understanding how it is actually >> "supposed" to be used (i.e. how it was designed to work). Is there >> an >> architectural overview floating around somewhere that I'm not aware >> of? > > Check out http://matplotlib.sourceforge.net/doc/html/users/ > artists.html That's just what I was looking for. However, unfortunately there appears to be some problem with the generation of the figures which are supposed to be embedded within that documentation - they're all appearing as nothing but blank white spaces, both in Firefox 3.0.3 on OS X 10.5.5, and when I download the files and view them with other programs. Do other people see this problem? Thanks again, Zane -- Zane Selvans Amateur Earthling za...@id... 303/815-6866 http://zaneselvans.org PGP Key: 55E0815F |
|
From: Jeff W. <js...@fa...> - 2008-10-09 20:13:15
|
John Hunter wrote: > On Thu, Oct 9, 2008 at 2:40 PM, Zane Selvans <za...@id...> wrote: > > >> Hmm. I'll have a look at these. Jeff Whitaker suggested them for >> something else too. I too often feel like I'm just hacking my way >> around in Matplotlib, without understanding how it is actually >> "supposed" to be used (i.e. how it was designed to work). Is there an >> architectural overview floating around somewhere that I'm not aware of? >> > > Check out http://matplotlib.sourceforge.net/doc/html/users/artists.html > and other docs at > http://matplotlib.sourceforge.net/doc/html/index.html > and basemap specific docs are at http://matplotlib.sourceforge.net/basemap/doc/html -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 |
|
From: Eric F. <ef...@ha...> - 2008-10-09 23:14:59
|
Zane Selvans wrote: > Zane Selvans <zane@...> writes: > >> I'm plotting a bunch of lines on a map. They're being colored >> according to the value of an attribute associated with the objects >> they represent, using a colormap. However, I also need to create a >> colorbar to act as a legend, describing what the colors of the lines >> means, in terms of values associated with that attribute. >> >> What's the easiest way to do that? > > I've found the matplotlib.colorbar.ColorbarBase class... and have been able to > use matplotlib.colorbar.make_axes() to create a somewhat acceptable set of axes > into which I can put a colorbar constructed from the same colormap that I'm > using to color the lines I'm plotting. However, I can't seem to get the tics > and axes on the colorbar to correspond to the values associated with the colors > - they only ever go from 0-1. I want them to go from, for instance, 0-180 > (degrees) in 20 or 30 degree intervals. It seemed like setting the keyword > arguments in ColorbarBase(boundaries=[0,180]) or values=linspace(0,180,10) or > something like that ought to have done the right thing... but no, and I don't > see any documentation on how these keywords are supposed to be used, in the > docstring or elsewhere... anyone know how they work? You probably want to use the ColorbarBase.add_lines() method; you can get an example of its use for line contours in the Colorbar class, and an example of the result is in examples/pylab_examples/contour_demo.py. Eric |
|
From: Eric F. <ef...@ha...> - 2008-10-13 23:57:04
|
Zane Selvans wrote: > > On Oct 9, 2008, at 12:55 PM, John Hunter wrote: > >> On Thu, Oct 9, 2008 at 2:40 PM, Zane Selvans <za...@id... >> <mailto:za...@id...>> wrote: >> >>> I too often feel like I'm just hacking my way >>> around in Matplotlib, without understanding how it is actually >>> "supposed" to be used (i.e. how it was designed to work). Is there an >>> architectural overview floating around somewhere that I'm not aware of? >> >> Check out http://matplotlib.sourceforge.net/doc/html/users/artists.html > > That's just what I was looking for. > > However, unfortunately there appears to be some problem with the > generation of the figures which are supposed to be embedded within that > documentation - they're all appearing as nothing but blank white spaces, > both in Firefox 3.0.3 on OS X 10.5.5, and when I download the files and > view them with other programs. Do other people see this problem? Yes, something is broken. I don't know how to fix it, though. Eric > > Thanks again, > Zane > > -- > Zane Selvans > Amateur Earthling > za...@id... <mailto:za...@id...> > 303/815-6866 > http://zaneselvans.org > PGP Key: 55E0815F > > > > > > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > > > ------------------------------------------------------------------------ > > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
|
From: Michael D. <md...@st...> - 2008-10-14 12:35:59
|
I saw this blank image problem a couple of weeks ago, and I was seeing it in my local doc builds as well. It appeared then that this change broke inline plots: """ r6089 | jdh2358 | 2008-09-13 10:28:09 -0400 (Sat, 13 Sep 2008) | 1 line replaced ipython run magic with code.InteractiveConsole.runsource """ because InteractiveConsole injects a number of things in __builtin__ that interfere with recent SVN versions of Sphinx. """ r6137 | mdboom | 2008-09-30 16:07:54 -0400 (Tue, 30 Sep 2008) | 3 lines [ 2138392 ] API doc for add_subplot() Also fixing numerous problems with the documentation build. It seems that the change in plot_directive.py to use the "code" module to run scripts interferes with i18n in Sphinx (due to the overloading of '_' as a symbol). Changed to use the fewer-moving-parts imp.load_module() instead. """ I changed this in SVN to just use imp.load_module instead, and this resolved the problem locally. I had expected the doc buildbot to pick it up and run with it, but I never followed up to see if it ever did. It's possible that this SF quota/login etc. problem has been blocking the updates all this time. So it's not necessarily that the files are transferring incorrectly, merely that they haven't been transferring at all since Sept 30 or before. If my change doesn't fix the image problem for you or the buildbot, let me know and I can revert it. Mike John Hunter wrote: > On Mon, Oct 13, 2008 at 6:56 PM, Eric Firing <ef...@ha...> wrote: > > >>> However, unfortunately there appears to be some problem with the >>> generation of the figures which are supposed to be embedded within that >>> documentation - they're all appearing as nothing but blank white spaces, >>> both in Firefox 3.0.3 on OS X 10.5.5, and when I download the files and view >>> them with other programs. Do other people see this problem? >>> >> Yes, something is broken. I don't know how to fix it, though. >> > > It looks like either the rsync screwed up or sf is throttling us or > both. I got this message in my cron job > > ssh: connect to host matplotlib.sf.net port 22: Connection refused > rsync: connection unexpectedly closed (0 bytes received so far) [sender] > rsync error: unexplained error (code 255) at io.c(453) [sender=2.6.9] > ssh: connect to host matplotlib.sf.net port 22: Connection refused > lost connection > > when I check the images in the > http://matplotlib.sourceforge.net/doc/html/pyplots/ directory, they > are there but are smaller in filesize than they are in the directory > on the build machine, suggesting they were truncated in the transfer. > When I try and log into the sf shell server > > > ssh -l jdh2358 shell.sf.net > > it hangs. > > Normally they send me an email when I am over file size quota, so I > would be surprised if they simply throttled us w/o a warning, but I > will file a ticket with the sf folks and see if they can help. > > JDH > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA |
|
From: John H. <jd...@gm...> - 2008-10-14 13:20:35
|
On Tue, Oct 14, 2008 at 7:35 AM, Michael Droettboom <md...@st...> wrote: > I saw this blank image problem a couple of weeks ago, and I was seeing it in > my local doc builds as well. > > It appeared then that this change broke inline plots: > > """ > r6089 | jdh2358 | 2008-09-13 10:28:09 -0400 (Sat, 13 Sep 2008) | 1 line > > replaced ipython run magic with code.InteractiveConsole.runsource > """ > > because InteractiveConsole injects a number of things in __builtin__ that > interfere with recent SVN versions of Sphinx. > > """ > r6137 | mdboom | 2008-09-30 16:07:54 -0400 (Tue, 30 Sep 2008) | 3 lines > > [ 2138392 ] API doc for add_subplot() > Also fixing numerous problems with the documentation build. It seems that > the change in plot_directive.py to use the "code" module to run scripts > interferes with i18n in Sphinx (due to the overloading of '_' as a symbol). > Changed to use the fewer-moving-parts imp.load_module() instead. > """ > > I changed this in SVN to just use imp.load_module instead, and this resolved > the problem locally. I had expected the doc buildbot to pick it up and run > with it, but I never followed up to see if it ever did. It's possible that > this SF quota/login etc. problem has been blocking the updates all this > time. So it's not necessarily that the files are transferring incorrectly, > merely that they haven't been transferring at all since Sept 30 or before. Just checked my cron emails again and indeed, the last successful update was in mid September. I'll need to keep a closer eye on these. Indeed, sourceforge revamped their shell services and I missed the email. Details are here http://sourceforge.net/community/forum/topic.php?id=3471&page&replies=2 Short answer: there is no longer any ssh shell access but sftp and rsync over ssh are supported. The new server is web.sf.net. I updated my makefile and synced the docs, so http://matplotlib.sourceforge.net/doc/html/ is live again JDH JDH |