You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(3) |
Jun
|
Jul
|
Aug
(12) |
Sep
(12) |
Oct
(56) |
Nov
(65) |
Dec
(37) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(59) |
Feb
(78) |
Mar
(153) |
Apr
(205) |
May
(184) |
Jun
(123) |
Jul
(171) |
Aug
(156) |
Sep
(190) |
Oct
(120) |
Nov
(154) |
Dec
(223) |
2005 |
Jan
(184) |
Feb
(267) |
Mar
(214) |
Apr
(286) |
May
(320) |
Jun
(299) |
Jul
(348) |
Aug
(283) |
Sep
(355) |
Oct
(293) |
Nov
(232) |
Dec
(203) |
2006 |
Jan
(352) |
Feb
(358) |
Mar
(403) |
Apr
(313) |
May
(165) |
Jun
(281) |
Jul
(316) |
Aug
(228) |
Sep
(279) |
Oct
(243) |
Nov
(315) |
Dec
(345) |
2007 |
Jan
(260) |
Feb
(323) |
Mar
(340) |
Apr
(319) |
May
(290) |
Jun
(296) |
Jul
(221) |
Aug
(292) |
Sep
(242) |
Oct
(248) |
Nov
(242) |
Dec
(332) |
2008 |
Jan
(312) |
Feb
(359) |
Mar
(454) |
Apr
(287) |
May
(340) |
Jun
(450) |
Jul
(403) |
Aug
(324) |
Sep
(349) |
Oct
(385) |
Nov
(363) |
Dec
(437) |
2009 |
Jan
(500) |
Feb
(301) |
Mar
(409) |
Apr
(486) |
May
(545) |
Jun
(391) |
Jul
(518) |
Aug
(497) |
Sep
(492) |
Oct
(429) |
Nov
(357) |
Dec
(310) |
2010 |
Jan
(371) |
Feb
(657) |
Mar
(519) |
Apr
(432) |
May
(312) |
Jun
(416) |
Jul
(477) |
Aug
(386) |
Sep
(419) |
Oct
(435) |
Nov
(320) |
Dec
(202) |
2011 |
Jan
(321) |
Feb
(413) |
Mar
(299) |
Apr
(215) |
May
(284) |
Jun
(203) |
Jul
(207) |
Aug
(314) |
Sep
(321) |
Oct
(259) |
Nov
(347) |
Dec
(209) |
2012 |
Jan
(322) |
Feb
(414) |
Mar
(377) |
Apr
(179) |
May
(173) |
Jun
(234) |
Jul
(295) |
Aug
(239) |
Sep
(276) |
Oct
(355) |
Nov
(144) |
Dec
(108) |
2013 |
Jan
(170) |
Feb
(89) |
Mar
(204) |
Apr
(133) |
May
(142) |
Jun
(89) |
Jul
(160) |
Aug
(180) |
Sep
(69) |
Oct
(136) |
Nov
(83) |
Dec
(32) |
2014 |
Jan
(71) |
Feb
(90) |
Mar
(161) |
Apr
(117) |
May
(78) |
Jun
(94) |
Jul
(60) |
Aug
(83) |
Sep
(102) |
Oct
(132) |
Nov
(154) |
Dec
(96) |
2015 |
Jan
(45) |
Feb
(138) |
Mar
(176) |
Apr
(132) |
May
(119) |
Jun
(124) |
Jul
(77) |
Aug
(31) |
Sep
(34) |
Oct
(22) |
Nov
(23) |
Dec
(9) |
2016 |
Jan
(26) |
Feb
(17) |
Mar
(10) |
Apr
(8) |
May
(4) |
Jun
(8) |
Jul
(6) |
Aug
(5) |
Sep
(9) |
Oct
(4) |
Nov
|
Dec
|
2017 |
Jan
(5) |
Feb
(7) |
Mar
(1) |
Apr
(5) |
May
|
Jun
(3) |
Jul
(6) |
Aug
(1) |
Sep
|
Oct
(2) |
Nov
(1) |
Dec
|
2018 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2025 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
|
1
(2) |
2
(5) |
3
(8) |
4
(6) |
5
(9) |
6
(7) |
7
(6) |
8
(10) |
9
(27) |
10
(7) |
11
(22) |
12
(13) |
13
(7) |
14
(4) |
15
(12) |
16
(32) |
17
(26) |
18
(14) |
19
(1) |
20
(11) |
21
(6) |
22
(11) |
23
(17) |
24
(18) |
25
(28) |
26
(11) |
27
(6) |
28
(1) |
29
(10) |
30
(12) |
|
|
|
|
Hello, I have a problem with polar plot, if i run the following code in matplotlib 0.98.3, polar plot is drawing a extra circle to go from angle -3.14159265 to angle 3.03753126. Is there a solution for this problem? ******************** import numpy as np from matplotlib.pyplot import figure, show, rc, grid # radar green, solid grid lines rc('grid', color='#316931', linewidth=1, linestyle='-') rc('xtick', labelsize=15) rc('ytick', labelsize=15) # force square figure and square axes looks better for polar, IMO fig = figure(figsize=(8,8)) ax = fig.add_axes([0.1, 0.1, 0.8, 0.8], polar=True, axisbg='#d5de9c') z = np.zeros((1,2000),complex) z.real = 0.2 z.imag = np.arange(-50,50,0.05) gamma_r = np.transpose((z-1)/(z+1)) ax.plot(np.angle(gamma_r), np.abs(gamma_r), '.-', zorder=0) ax.set_rmax(2.0) grid(True) show() ******************** Kind regards, Jean -- Jan Gillis Ghent University IMEC vzw - INTEC Sint-Pietersnieuwstraat 41 B-9000 Gent Belgium tel. +32 9 264 33 33 jan...@in...
We have some experience maintaining persistent object storage over long periods of time. The best solution we've found is to do something like this: - create a read/write method on each class. Every class that needs to be stored must have this. This includes class you would store (eg Figure) and things that are member variables of those classes. - Each class stores a version number along with it's data which represents the version of the persistent representation for that class. So each class has its own, internal versioning scheme that represents a specific set of variables with specific types. - The read method on each class must check the version number and then read the appropriate data for that version of itself. Whenever the persistent representation of the class changes (usually if the member variables change), you increment the version number. Implicit in this is that if you change the member variables of a class, the class read method must be able to convert the variables that existed in the older version of itself into the new member variables (since that's what the new methods on that class will be using) FYI It is possible to use pickle to do this but you can't rely on pickle to automatically save the member dictionary. You need to implement __getstate__ and __setstate__ and have them incorporate a version number in the dictionary they return. In addition, you shouldn't blindly save every member variable. If member variables can be constructed in terms of other data, it may be better to store that data and then reconstruct the member variables in the __setstate__ method. Using this type of system, you get a hierarchy of objects that each have their own, internal versioning system. This lets you make changes to a single class, increment it's version, and update its save/load methods and it won't affect any other part of the system and still retains backwards reading capability. Ted > -----Original Message----- > From: mat...@li... > [mailto:mat...@li...] On Behalf Of > Eric Firing > Sent: Tuesday, September 16, 2008 7:04 PM > To: John Hunter > Cc: Josef Koller; mat...@li... > Subject: Re: [Matplotlib-users] save or pickle figure object > > John Hunter wrote: > > On Tue, Sep 16, 2008 at 5:06 PM, Josef Koller <jk...@la...> > wrote: > >> Hi folks, > >> I would like to save preliminary figures for later processing and > >> refinement with matplotlib. Is there a way to save or pickle a > figure > >> object and later reload it. Matlab has a feature like that and and I > was > >> wondering if matplotlib has it too. > > > > No, it doesn't exist. We've taken a stab at it once or twice, but > > have been stymied because we make extensive use of a python extension > > libray CXX, and these objects have resisted our attempts to pickle > > them. With our recent transforms refactoring, which removes the > > hairiest CXX dependency, it may be worth taking another look, but > > noone is currently working on it. > > My sense, based on very little experience, is that pickles of > complicated objects are very fragile, so even if we could pickle > figures, I fear it might cause more trouble ("I can't load this > absolutely critical figure I pickled 6 months ago") than it would be > worth. > > Eric > > ----------------------------------------------------------------------- > -- > 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 > Checked by AVG - http://www.avg.com > Version: 8.0.169 / Virus Database: 270.6.21/1674 - Release Date: > 9/16/2008 8:15 AM
On Tue, Sep 16, 2008 at 8:17 PM, Sebastien Binet <hep...@gm...> wrote: > Hi Anthony, > >> As you've already been told, you can't pickle/shelve mpl objects. Our >> solution to this is to have a native python shadow object that >> contains all the bits and pieces needed to create a figure, and always >> build the plots from these shadow objects. This gives us the >> advantage of being able to shelve the shadow objects and rebuild the >> figures later. > > this is rather interesting ! > any code to point to ? Hi Sebastien, I'll see what I can extract from the code tomorrow at work. It's pretty modular so I should be able to point to something. A>
Hi Anthony, > As you've already been told, you can't pickle/shelve mpl objects. Our > solution to this is to have a native python shadow object that > contains all the bits and pieces needed to create a figure, and always > build the plots from these shadow objects. This gives us the > advantage of being able to shelve the shadow objects and rebuild the > figures later. this is rather interesting ! any code to point to ? cheers, sebastien. -- ################################### # Dr. Sebastien Binet # Lawrence Berkeley National Lab. # 1 Cyclotron Road # Berkeley, CA 94720 ###################################
On Tue, Sep 16, 2008 at 3:06 PM, Josef Koller <jk...@la...> wrote: > Hi folks, > I would like to save preliminary figures for later processing and > refinement with matplotlib. Is there a way to save or pickle a figure > object and later reload it. Matlab has a feature like that and and I was > wondering if matplotlib has it too. > > Thanks a lot, > > Josef As you've already been told, you can't pickle/shelve mpl objects. Our solution to this is to have a native python shadow object that contains all the bits and pieces needed to create a figure, and always build the plots from these shadow objects. This gives us the advantage of being able to shelve the shadow objects and rebuild the figures later. Of course, we're doing this in context of a large program using the mpl api, so if you're just using pylab, you're a bit SOL. A>
On Tue, Sep 16, 2008 at 9:00 PM, James Schombert <jsc...@uo...> wrote: > I'm switching from an old graphics package (PGPLOT) to matplotlib, and I > prefer to use the graphics window to input commands (such as, a new > file name) by typing at the bottom of the frame > > so if the file name, for example, has a 'g' or 'l' in its name, the > window redraws a grid or log > > it would be nice to have some sort of disable option, or a freeze method > until I have finished inputing the text > > currently my work around is to test for a 'g' or 'l' and ax.grid(False) plus > a forced redraw, but this is not elegant and breaks the flow of my analysis > routines This will not be particularly hard to conditionally turn off -- the question is what is the best mechanism? The main choices are: * rc param - global for all figures * figure param - specific to a given figure; interface would be something like: fig.auto_toolbar_keys(False) * axes param: specific for a given axes in figure; interface would be something like ax.auto_toolbar_keys(False) Any preferences, thoughts? I think the ability to turn this off is pretty important for application developers and others. I guess another option would be to support an rc param like figure.toolbar_keys : l, g, f, a which is a sequence of keys that will generate the default behavior (log, grid, fullscreen, set_navigate on all). The user could set just the elements of the list that they want to have the default action for (or None) JDH
John Hunter wrote: > On Tue, Sep 16, 2008 at 5:06 PM, Josef Koller <jk...@la...> wrote: >> Hi folks, >> I would like to save preliminary figures for later processing and >> refinement with matplotlib. Is there a way to save or pickle a figure >> object and later reload it. Matlab has a feature like that and and I was >> wondering if matplotlib has it too. > > No, it doesn't exist. We've taken a stab at it once or twice, but > have been stymied because we make extensive use of a python extension > libray CXX, and these objects have resisted our attempts to pickle > them. With our recent transforms refactoring, which removes the > hairiest CXX dependency, it may be worth taking another look, but > noone is currently working on it. My sense, based on very little experience, is that pickles of complicated objects are very fragile, so even if we could pickle figures, I fear it might cause more trouble ("I can't load this absolutely critical figure I pickled 6 months ago") than it would be worth. Eric
On Tue, Sep 16, 2008 at 8:03 PM, James Schombert <jsc...@uo...> wrote: > in matplotlib under 10.5 Mac OS X, if the event.key > is 'g' or 'l' then grid plotting ('g') or log plotting > ('l') is turned on > > is this a known bug? any workarounds? It's a feature, not a bug. Do you have a use case where this is an annoyance -- we could probably disable it under certain conditions. JDH
On Tue, Sep 16, 2008 at 5:06 PM, Josef Koller <jk...@la...> wrote: > Hi folks, > I would like to save preliminary figures for later processing and > refinement with matplotlib. Is there a way to save or pickle a figure > object and later reload it. Matlab has a feature like that and and I was > wondering if matplotlib has it too. No, it doesn't exist. We've taken a stab at it once or twice, but have been stymied because we make extensive use of a python extension libray CXX, and these objects have resisted our attempts to pickle them. With our recent transforms refactoring, which removes the hairiest CXX dependency, it may be worth taking another look, but noone is currently working on it. JDH
in matplotlib under 10.5 Mac OS X, if the event.key is 'g' or 'l' then grid plotting ('g') or log plotting ('l') is turned on is this a known bug? any workarounds? J
On 2008年9月16日, charles reid apparently wrote: > f.legend(line1,('CO2'),loc=(0.8,0.8)) ('CO2') is a string not a tuple. ('CO2',) is a tuple. hth, Alan Isaac
Hi folks, I would like to save preliminary figures for later processing and refinement with matplotlib. Is there a way to save or pickle a figure object and later reload it. Matlab has a feature like that and and I was wondering if matplotlib has it too. Thanks a lot, Josef -- Josef Koller (TSPA/Correspondence) Space Science and Applications, ISR-1, MS D466 Los Alamos National Laboratory, NM 87545-1663 Phone: (505) 665 3399 http://www.koller.info Fax: (505) 665 7395 email jk...@la...
Thank you for the immediate and extremely helpful suggestions. Changing the string to a tuple works great, and I did not think about using the "label" keyword in plot. I think this will greatly simplify the plotting. Thanks again for the "instant gratification". :) Charles ========== The 2nd Law of Thermodynamics... If you think things are a mess now, JUST WAIT! On Tue, Sep 16, 2008 at 3:28 PM, Jae-Joon Lee <lee...@gm...> wrote: > ('CO2') is not a tuple but still a single string. > You may use a list ['CO2'] or put an extra "," to make it a tuple > ('CO2',). > > And, you may consider to use the "label" keyword with your plot command. > IHTH, > > -JJ > > > > On Tue, Sep 16, 2008 at 5:09 PM, charles reid <cha...@gm...> > wrote: > > Hi there - > > > > I'm using the latest stable pylab/matplotlib (0.98.3) via OS X 10.5.4. I am > > plotting a simple array of data, and I'm getting some strange behavior > when > > I try to add a legend to the plot. > > First, the plot without the legend: > > > > f=figure(1) > > title("Equilibrium Concentration vs. Equivalence Ratio") > > line1 = plot(phi,xeq[1]) > > show() > > > > This works fine. However, when I try to add a legend, I get an error. I > > add this: > > > > f=figure(1) > > title("Equilibrium Concentration vs. Equivalence Ratio") > > line1 = plot(phi,xeq[1]) > > f.legend(line1,('CO2'),loc=(0.8,0.8)) > > show() > > > > And it gives me an error because of the second argument to f.legend: > > > > > --------------------------------------------------------------------------- > > ValueError Traceback (most recent call > last) > > > > /Users/charles/Documents/school/combustion/problem-2-52/adiabatic.py in > > <module>() > > 111 title("Equilibrium Concentrations vs. Equivalence Ratio") > > 112 line1=plot(phi,xeq[1]) > > --> 113 f.legend(line1,('CO2'),loc=(0.8,0.8)) > > 114 show() > > 115 > > > > > /Library/Python/2.5/site-packages/matplotlib-0.98.3-py2.5-macosx-10.3-i386.egg/matplotlib/figure.pyc > > in legend(self, handles, labels, *args, **kwargs) > > 841 """ > > 842 handles = flatten(handles) > > --> 843 l = Legend(self, handles, labels, *args, **kwargs) > > 844 self.legends.append(l) > > 845 return l > > > > > /Library/Python/2.5/site-packages/matplotlib-0.98.3-py2.5-macosx-10.3-i386.egg/matplotlib/legend.pyc > > in __init__(self, parent, handles, labels, loc, numpoints, prop, pad, > > markerscale, labelsep, handlelen, handletextsep, axespad, shadow) > > 180 textleft = left+ self.handlelen+self.handletextsep > > 181 self.texts = self._get_texts(labels, textleft, top) > > --> 182 self.legendHandles = self._get_handles(handles, > self.texts) > > 183 > > 184 self._drawFrame = True > > > > > /Library/Python/2.5/site-packages/matplotlib-0.98.3-py2.5-macosx-10.3-i386.egg/matplotlib/legend.pyc > > in _get_handles(self, handles, texts) > > 246 # centered marker proxy > > 247 > > --> 248 for handle, label in safezip(handles, texts): > > 249 if self.numpoints > 1: > > 250 xdata = np.linspace(left, left + self.handlelen, > > self.numpoints) > > > > > /Library/Python/2.5/site-packages/matplotlib-0.98.3-py2.5-macosx-10.3-i386.egg/matplotlib/cbook.pyc > > in safezip(*args) > > 899 for i, arg in enumerate(args[1:]): > > 900 if len(arg) != Nx: > > --> 901 raise ValueError(_safezip_msg % (Nx, i+1, len(arg))) > > 902 return zip(*args) > > 903 > > > > ValueError: In safezip, len(args[0])=1 but len(args[1])=3 > > WARNING: Failure executing file: <adiabatic.py> > > > > I don't understand why this doesn't work, because I should be able to > give a > > label of arbitrary length. It doesn't work when I replace single quotes > > with double quotes, either. But I change the length to 1, like it wants: > > > > f=figure(1) > > title("Equilibrium Concentrations vs. Equivalence Ratio") > > line1=plot(phi,xeq[1]) > > f.legend(line1,('C'),loc=(0.8,0.8)) > > show() > > > > Which creates a plot, with a legend, but when I move the mouse over the > > plot, it has the "thinking" cursor (hourglass). I can't close the > window > > using the buttons in the upper left hand corner, I can't close it using > > close(1), and I can't close it using close('all'). I end up having to > run > > 'killall Python' from a command line. > > > > I can get the plot with the legend to work, albeit with only ONE > character > > for the name, by running (from Python) > > > > f=figure(1) > > title("Equilibrium Concentrations vs. Equivalence Ratio") > > line1=plot(phi,xeq[1]) > > f.legend(line1,('C'),loc=(0.8,0.8)) > > > > (without the show() command) in the script, then running show() when the > > script is done, and I don't get the "thinking" cursor. > > > > Note: I have also used the function figlegend() with the exact same > > results/problems. > > > > 1. How can I give a legend name with a length of more than 1 character? > > What am I doing wrong? > > 2. What is causing the behavior with the thinking cursor? > > > > > > Also, ultimately I would like to make a plot with 30+ species, instead of > > just CO2. Is there a way to do this other than doing the following? > > > > line1 line2 line3 ........ = > > plot(phi,xeq[1],phi,xeq[2],phi,xeq[3],...........) > > > f.legend((line1,line2,...........),(name[0],name[1],name[2],................),loc=(0.8,0.8)) > > > > Thanks ahead of time for any suggestions or hints. > > > > > > > > Charles > > > > > > > > > > ------------------------------------------------------------------------- > > 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 > > > > >
On Tue, Sep 16, 2008 at 4:09 PM, charles reid <cha...@gm...> wrote: > Hi there - > > I'm using the latest stable pylab/matplotlib (0.98.3) via OS X 10.5.4. I am > plotting a simple array of data, and I'm getting some strange behavior when > I try to add a legend to the plot. > First, the plot without the legend: > > f=figure(1) > title("Equilibrium Concentration vs. Equivalence Ratio") > line1 = plot(phi,xeq[1]) > show() > > This works fine. However, when I try to add a legend, I get an error. I > add this: > > f=figure(1) > title("Equilibrium Concentration vs. Equivalence Ratio") > line1 = plot(phi,xeq[1]) > f.legend(line1,('CO2'),loc=(0.8,0.8)) > show() legend expects a sequence of strings ('CO2') is a string ('CO2',) is a length one sequence of strings ['CO2'] is also a length 1 sequence of strings When using parentheses to create a tuple, you must use a comma to disambiguate the alternative meaning of grouping. JDH
Charles, The legend functions needs a sequence-type object (list,etc) not a tuple as the second argument. The following should work: f.legend(line1,['CO2'],loc=(0.8,0.8)) Not sure about the cursor issue, see if the above solves the problem. You should be able to add a number of plots more effectively using a for loop: lines = [] names = ["CO2","H2O","etc"] for y in xeq: lines.append( plot(phi,y) ) f.legend( lines,names,loc=(0.8,0.8) ) Cheers, -Jonathan Helmus charles reid wrote: > Hi there - > > I'm using the latest stable pylab/matplotlib (0.98.3) via OS X 10.5.4. > <http://10.5.4.> I am plotting a simple array of data, and I'm > getting some strange behavior when I try to add a legend to the plot. > First, the plot without the legend: > > f=figure(1) > title("Equilibrium Concentration vs. Equivalence Ratio") > line1 = plot(phi,xeq[1]) > show() > > This works fine. However, when I try to add a legend, I get an > error. I add this: > > f=figure(1) > title("Equilibrium Concentration vs. Equivalence Ratio") > line1 = plot(phi,xeq[1]) > f.legend(line1,('CO2'),loc=(0.8,0.8)) > show() > > And it gives me an error because of the second argument to f.legend: > > --------------------------------------------------------------------------- > ValueError Traceback (most recent call > last) > > /Users/charles/Documents/school/combustion/problem-2-52/adiabatic.py > in <module>() > 111 title("Equilibrium Concentrations vs. Equivalence Ratio") > 112 line1=plot(phi,xeq[1]) > --> 113 f.legend(line1,('CO2'),loc=(0.8,0.8)) > 114 show() > 115 > > /Library/Python/2.5/site-packages/matplotlib-0.98.3-py2.5-macosx-10.3-i386.egg/matplotlib/figure.pyc > in legend(self, handles, labels, *args, **kwargs) > 841 """ > 842 handles = flatten(handles) > --> 843 l = Legend(self, handles, labels, *args, **kwargs) > 844 self.legends.append(l) > 845 return l > > /Library/Python/2.5/site-packages/matplotlib-0.98.3-py2.5-macosx-10.3-i386.egg/matplotlib/legend.pyc > in __init__(self, parent, handles, labels, loc, numpoints, prop, pad, > markerscale, labelsep, handlelen, handletextsep, axespad, shadow) > 180 textleft = left+ self.handlelen+self.handletextsep > 181 self.texts = self._get_texts(labels, textleft, top) > --> 182 self.legendHandles = self._get_handles(handles, > self.texts) > 183 > 184 self._drawFrame = True > > /Library/Python/2.5/site-packages/matplotlib-0.98.3-py2.5-macosx-10.3-i386.egg/matplotlib/legend.pyc > in _get_handles(self, handles, texts) > 246 # centered marker proxy > 247 > --> 248 for handle, label in safezip(handles, texts): > 249 if self.numpoints > 1: > 250 xdata = np.linspace(left, left + > self.handlelen, self.numpoints) > > /Library/Python/2.5/site-packages/matplotlib-0.98.3-py2.5-macosx-10.3-i386.egg/matplotlib/cbook.pyc > in safezip(*args) > 899 for i, arg in enumerate(args[1:]): > 900 if len(arg) != Nx: > --> 901 raise ValueError(_safezip_msg % (Nx, i+1, len(arg))) > 902 return zip(*args) > 903 > > ValueError: In safezip, len(args[0])=1 but len(args[1])=3 > WARNING: Failure executing file: <adiabatic.py> > > I don't understand why this doesn't work, because I should be able to > give a label of arbitrary length. It doesn't work when I replace > single quotes with double quotes, either. But I change the length to > 1, like it wants: > > f=figure(1) > title("Equilibrium Concentrations vs. Equivalence Ratio") > line1=plot(phi,xeq[1]) > f.legend(line1,('C'),loc=(0.8,0.8)) > show() > > Which creates a plot, with a legend, but when I move the mouse over > the plot, it has the "thinking" cursor (hourglass). I can't close > the window using the buttons in the upper left hand corner, I can't > close it using close(1), and I can't close it using close('all'). I > end up having to run 'killall Python' from a command line. > > I can get the plot with the legend to work, albeit with only ONE > character for the name, by running (from Python) > > f=figure(1) > title("Equilibrium Concentrations vs. Equivalence Ratio") > line1=plot(phi,xeq[1]) > f.legend(line1,('C'),loc=(0.8,0.8)) > > (without the show() command) in the script, then running show() when > the script is done, and I don't get the "thinking" cursor. > > Note: I have also used the function figlegend() with the exact same > results/problems. > > 1. How can I give a legend name with a length of more than 1 > character? What am I doing wrong? > 2. What is causing the behavior with the thinking cursor? > > > Also, ultimately I would like to make a plot with 30+ species, instead > of just CO2. Is there a way to do this other than doing the following? > > line1 line2 line3 ........ = > plot(phi,xeq[1],phi,xeq[2],phi,xeq[3],...........) > f.legend((line1,line2,...........),(name[0],name[1],name[2],................),loc=(0.8,0.8)) > > Thanks ahead of time for any suggestions or hints. > > > > Charles > > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > 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 >
To whom it may concern, Please remove me from the email list. Thanks! Chris
Hi there - I'm using the latest stable pylab/matplotlib (0.98.3) via OS X 10.5.4. I am plotting a simple array of data, and I'm getting some strange behavior when I try to add a legend to the plot. First, the plot without the legend: f=figure(1) title("Equilibrium Concentration vs. Equivalence Ratio") line1 = plot(phi,xeq[1]) show() This works fine. However, when I try to add a legend, I get an error. I add this: f=figure(1) title("Equilibrium Concentration vs. Equivalence Ratio") line1 = plot(phi,xeq[1]) f.legend(line1,('CO2'),loc=(0.8,0.8)) show() And it gives me an error because of the second argument to f.legend: --------------------------------------------------------------------------- ValueError Traceback (most recent call last) /Users/charles/Documents/school/combustion/problem-2-52/adiabatic.py in <module>() 111 title("Equilibrium Concentrations vs. Equivalence Ratio") 112 line1=plot(phi,xeq[1]) --> 113 f.legend(line1,('CO2'),loc=(0.8,0.8)) 114 show() 115 /Library/Python/2.5/site-packages/matplotlib-0.98.3-py2.5-macosx-10.3-i386.egg/matplotlib/figure.pyc in legend(self, handles, labels, *args, **kwargs) 841 """ 842 handles = flatten(handles) --> 843 l = Legend(self, handles, labels, *args, **kwargs) 844 self.legends.append(l) 845 return l /Library/Python/2.5/site-packages/matplotlib-0.98.3-py2.5-macosx-10.3-i386.egg/matplotlib/legend.pyc in __init__(self, parent, handles, labels, loc, numpoints, prop, pad, markerscale, labelsep, handlelen, handletextsep, axespad, shadow) 180 textleft = left+ self.handlelen+self.handletextsep 181 self.texts = self._get_texts(labels, textleft, top) --> 182 self.legendHandles = self._get_handles(handles, self.texts) 183 184 self._drawFrame = True /Library/Python/2.5/site-packages/matplotlib-0.98.3-py2.5-macosx-10.3-i386.egg/matplotlib/legend.pyc in _get_handles(self, handles, texts) 246 # centered marker proxy 247 --> 248 for handle, label in safezip(handles, texts): 249 if self.numpoints > 1: 250 xdata = np.linspace(left, left + self.handlelen, self.numpoints) /Library/Python/2.5/site-packages/matplotlib-0.98.3-py2.5-macosx-10.3-i386.egg/matplotlib/cbook.pyc in safezip(*args) 899 for i, arg in enumerate(args[1:]): 900 if len(arg) != Nx: --> 901 raise ValueError(_safezip_msg % (Nx, i+1, len(arg))) 902 return zip(*args) 903 ValueError: In safezip, len(args[0])=1 but len(args[1])=3 WARNING: Failure executing file: <adiabatic.py> I don't understand why this doesn't work, because I should be able to give a label of arbitrary length. It doesn't work when I replace single quotes with double quotes, either. But I change the length to 1, like it wants: f=figure(1) title("Equilibrium Concentrations vs. Equivalence Ratio") line1=plot(phi,xeq[1]) f.legend(line1,('C'),loc=(0.8,0.8)) show() Which creates a plot, with a legend, but when I move the mouse over the plot, it has the "thinking" cursor (hourglass). I can't close the window using the buttons in the upper left hand corner, I can't close it using close(1), and I can't close it using close('all'). I end up having to run 'killall Python' from a command line. I can get the plot with the legend to work, albeit with only ONE character for the name, by running (from Python) f=figure(1) title("Equilibrium Concentrations vs. Equivalence Ratio") line1=plot(phi,xeq[1]) f.legend(line1,('C'),loc=(0.8,0.8)) (without the show() command) in the script, then running show() when the script is done, and I don't get the "thinking" cursor. Note: I have also used the function figlegend() with the exact same results/problems. 1. How can I give a legend name with a length of more than 1 character? What am I doing wrong? 2. What is causing the behavior with the thinking cursor? Also, ultimately I would like to make a plot with 30+ species, instead of just CO2. Is there a way to do this other than doing the following? line1 line2 line3 ........ = plot(phi,xeq[1],phi,xeq[2],phi,xeq[3],...........) f.legend((line1,line2,...........),(name[0],name[1],name[2],................),loc=(0.8,0.8)) Thanks ahead of time for any suggestions or hints. Charles
Excellent, thanks!!! DG --- On Tue, 9/16/08, John Hunter <jd...@gm...> wrote: > From: John Hunter <jd...@gm...> > Subject: Re: [Matplotlib-users] 'Inverting' a colormap (was "Next problem: pixel-to-pixel alpha variation") > To: d_l...@ya... > Cc: mat...@li... > Date: Tuesday, September 16, 2008, 12:46 PM > On Tue, Sep 16, 2008 at 2:40 PM, David Goldsmith > <d_l...@ya...> wrote: > > --- On Tue, 9/9/08, David Goldsmith > <d_l...@ya...> wrote: > > > >> eventually ... I'd like to do what John > implies > >> is possible, i.e., "invert" a cm back to > its RGB > >> table - John (or anyone) can you short-cut the > learning > >> process for me w/ a code example of how to do > this? :-) > >> Thanks! > >> > >> DG > > > > No one has a shareable code example of how to invert a > colormap to an RGB array? > > Is this what you are looking for? (outputs RGBA but just > override the > alpha or extract the RGB part) > > > >In [9]: import matplotlib.cm as cm > > In [10]: x = np.arange(0, 1, 0.1) > > In [11]: print cm.jet(x) > [[ 0. 0. 0.5 1. ] > [ 0. 0. 0.9456328 1. ] > [ 0. 0.3 1. 1. ] > [ 0. 0.69215686 1. 1. ] > [ 0.16129032 1. 0.80645161 1. ] > [ 0.49019608 1. 0.47754586 1. ] > [ 0.80645161 1. 0.16129032 1. ] > [ 1. 0.77051561 0. 1. ] > [ 1. 0.40740741 0. 1. ] > [ 0.9456328 0.02977487 0. 1. ]]
De Pauw Antoine wrote: > Jeff, > > In fact my satellite data is displaying clouds of various gases, and I don’t > like the fact that "empty" places are left dark blue (I use jet reversed > cmap) > > By masking data under a certain value, I isolate the clouds and then they > are in evidence > > When I use vmin and vmax I'm able to avoid the colormap rescaling and I keep > the cloud's original colour, but then it is the colorbar which poses > problems, as there's a part of the bar that is useless Can you provide a compact example script, completely self-contained, that illustrates the problem with the colorbar? Perhaps by modifying one of the standard mpl examples, such as image_masked.py? From what you have said, I would expect that some combination of masking, using vmin and vmax, and using the special value colors, would work adequately with the present colorbar. Eric
On Tue, Sep 16, 2008 at 2:40 PM, David Goldsmith <d_l...@ya...> wrote: > --- On Tue, 9/9/08, David Goldsmith <d_l...@ya...> wrote: > >> eventually ... I'd like to do what John implies >> is possible, i.e., "invert" a cm back to its RGB >> table - John (or anyone) can you short-cut the learning >> process for me w/ a code example of how to do this? :-) >> Thanks! >> >> DG > > No one has a shareable code example of how to invert a colormap to an RGB array? Is this what you are looking for? (outputs RGBA but just override the alpha or extract the RGB part) >In [9]: import matplotlib.cm as cm In [10]: x = np.arange(0, 1, 0.1) In [11]: print cm.jet(x) [[ 0. 0. 0.5 1. ] [ 0. 0. 0.9456328 1. ] [ 0. 0.3 1. 1. ] [ 0. 0.69215686 1. 1. ] [ 0.16129032 1. 0.80645161 1. ] [ 0.49019608 1. 0.47754586 1. ] [ 0.80645161 1. 0.16129032 1. ] [ 1. 0.77051561 0. 1. ] [ 1. 0.40740741 0. 1. ] [ 0.9456328 0.02977487 0. 1. ]]
--- On Tue, 9/9/08, David Goldsmith <d_l...@ya...> wrote: > eventually ... I'd like to do what John implies > is possible, i.e., "invert" a cm back to its RGB > table - John (or anyone) can you short-cut the learning > process for me w/ a code example of how to do this? :-) > Thanks! > > DG No one has a shareable code example of how to invert a colormap to an RGB array? DG
Hi, I am new to Python and trying to use Cell and its method auto_set_font_size() here is the code " def draw_Cell(self, lower, upper, node1, branch_name): c = Cell(lower, upper[0]-lower[0], upper[1] - lower[1], edgecolor='k', text = branch_name, facecolor= self.color_method(node1), loc = None) self.ax.add_patch(c) " My question is how do I use the method 'auto_set_font_size()' to shrink font size to fit the text. Thanks Samir
You can just do ax.legend(prop=fm.FontProperties('Tahoma')) Cheers, Mike sa6113 wrote: > I want to set font name to 'tahoma.ttf' this code work propely but is there > any way I don't want to use full path name in fname property. > > import matplotlib.font_manager as fm > import matplotlib.pyplot as plt > > fig = plt.figure() > ax = fig.add_subplot(111) > ax.plot([1,2,3], label='test') > > ax.legend(prop=fm.FontProperties(fname='c:/windows/fonts/tahoma.ttf')) > plt.show() > -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA
Hello, I have a problem with polar plot, if i run the following code in matplotlib 0.98.3, polar plot is drawing a extra circle to go from angle -3.14159265 to angle 3.03753126. Is there a solution for this problem? ******************** import numpy as np from matplotlib.pyplot import figure, show, rc, grid # radar green, solid grid lines rc('grid', color='#316931', linewidth=1, linestyle='-') rc('xtick', labelsize=15) rc('ytick', labelsize=15) # force square figure and square axes looks better for polar, IMO fig = figure(figsize=(8,8)) ax = fig.add_axes([0.1, 0.1, 0.8, 0.8], polar=True, axisbg='#d5de9c') z = np.zeros((1,2000),complex) z.real = 0.2 z.imag = np.arange(-50,50,0.05) gamma_r = np.transpose((z-1)/(z+1)) ax.plot(np.angle(gamma_r), np.abs(gamma_r), '.-', zorder=0) ax.set_rmax(2.0) grid(True) show() ******************** Kind regards, Jean
Jeff, In fact my satellite data is displaying clouds of various gases, and I dont like the fact that "empty" places are left dark blue (I use jet reversed cmap) By masking data under a certain value, I isolate the clouds and then they are in evidence When I use vmin and vmax I'm able to avoid the colormap rescaling and I keep the cloud's original colour, but then it is the colorbar which poses problems, as there's a part of the bar that is useless I guess what I should do is setting a new colorbar myself, but there again, it is not very easy to understand... that kind of libraries are really occult for a non-scientific IT graduate like me Now for the antialiasing and interpolation, the thing I try to do is making it look less pixeled, I don't need all the points to be interpolated, but just make the existing points smoother to have a smooth, quality figure You have helped me a lot, and I know my questions were beginners ones, so I'll understand if you prefer giving some time to something more interesting Antoine De Pauw Collaborateur de recherches, Informatique - Research collaborator, IT Laboratoire de chimie quantique et photophysique - Quantum chemistry and photophysics laboratory Université Libre de Bruxelles - ULB -----Original Message----- From: Jeff Whitaker [mailto:js...@fa...] Sent: mardi 16 septembre 2008 13:16 To: De Pauw Antoine Cc: 'Matplotlib Users' Subject: Re: [Matplotlib-users] Information request De Pauw Antoine wrote: > Hi Jeff, > > I have played a bit with Matplotlib since last week, and I may still have > some questions for you > > I have masked my value array so it doesn't draw points under a certain > value, but doing this causes the colormap to rescale for the new values > Antoine: Don't quite know what you're trying to accomplish, but you can use the vmin/vmax keywords to imshow, pcolor or scatter to scale the colormap to a certain range. Also, take a look at the image_masked.py example to see how to set the 'over/under' color in a colormap. > I have tried to set a custom colormap but it isn't the thing to do as data > is varying in time > > So is it possible to avoid the colormap to rescale itself? > > Also, I had a look at imshow and the interpolation process is really > interesting for smooth maps.. does a way to interpolate scattered data > exist? > If you have the most recent version of matplotlib you can use the griddata function to interpolate scattered data to a regular grid. -Jeff > The code I use didn't change since last time, all I did is adding a bit, > testing and deleting.. > > Best regards, > > Antoine De Pauw > Collaborateur de recherches, Informatique - Research collaborator, IT > Laboratoire de chimie quantique et photophysique - Quantum chemistry and > photophysics laboratory > Université Libre de Bruxelles - ULB > > -----Original Message----- > From: Jeff Whitaker [mailto:js...@fa...] > Sent: vendredi 12 septembre 2008 13:26 > To: De Pauw Antoine > Cc: 'Matplotlib Users' > Subject: Re: [Matplotlib-users] Information request > > De Pauw Antoine wrote: > >> Hi Jeff, >> >> I updated my code snippet and uploaded the image I created with a complete >> set of data: >> >> http://snipplr.com/view/8307/map-plotting-python-code-temporary/ >> >> And here's the picture generated: >> >> http://www.kirikoo.net/images/5shrad-20080912-105759.png >> >> I now understand the process and I'm able to reproduce it for other >> datasets, but I need to implement some antialiasing for it.. >> >> Is it possible to do? >> >> Many thanks for your precious help! >> >> Antoine De Pauw >> Collaborateur de recherches, Informatique - Research collaborator, IT >> Laboratoire de chimie quantique et photophysique - Quantum chemistry and >> photophysics laboratory >> Université Libre de Bruxelles - ULB >> >> > > Antoine: If you do > > >>> from pylab import scatter > >>> help(scatter) > > you will see that scatter takes an antialised keyword > > antialiased Boolean or sequence of booleans > > -Jeff > > >> -----Original Message----- >> From: Jeff Whitaker [mailto:js...@fa...] >> Sent: jeudi 11 septembre 2008 16:48 >> To: De Pauw Antoine >> Cc: 'Matplotlib Users' >> Subject: Re: [Matplotlib-users] Information request >> >> De Pauw Antoine wrote: >> >> >>> Jeff, >>> >>> The map object is from the Basemap type, the only different thing is the >>> Lon,Lat and Val objects which are from the type array instead of lists >>> >>> Anyway, solutions are slowly showing themselves and I thank you all >>> >>> Have a nice day >>> >>> Antoine De Pauw >>> Collaborateur de recherches, Informatique - Research collaborator, IT >>> Laboratoire de chimie quantique et photophysique - Quantum chemistry and >>> photophysics laboratory >>> Université Libre de Bruxelles - ULB >>> >>> >>> >> Antoine: It should not matter if Lon and Lat are python arrays, lists >> or numpy arrays. The Basemap instance __call__ method handles them all. >> There must be something else going on. It is always better to post >> actual code so we can see what is happening and test it ourselves. >> >> -Jeff >> >> >>> -----Original Message----- >>> From: Jeff Whitaker [mailto:js...@fa...] >>> Sent: jeudi 11 septembre 2008 15:29 >>> To: De Pauw Antoine >>> Cc: 'Matplotlib Users' >>> Subject: Re: [Matplotlib-users] Information request >>> >>> De Pauw Antoine wrote: >>> >>> >>> >>>> Thanks Jeff, >>>> >>>> This seems to work with csv file types, and I've been experimenting a >>>> > bit > >>>> with it >>>> >>>> However, when I try to implement this with my original code (with binary >>>> files), I get an error like that one: >>>> >>>> Traceback (most recent call last): >>>> File "C:\Python25\Projects\FigPlot\FigPlot.py", line 39, in <module> >>>> x,y = map(Lon,Lat) >>>> TypeError: 'numpy.ndarray' object is not callable >>>> >>>> I think this is coming from the fact I use array objects to store >>>> >>>> >>>> >>> values... >>> >>> >>> >>>> could you confirm it? >>>> >>>> >>>> >>>> >>> Antoine: It looks like you the object map is not a Basemap instance, >>> but a numpy array. Try putting 'print type(map)' just ahead of this >>> statement to verify this. I suspect your re-using the name 'map' in your >>> code, overwriting the Basemap class instance. >>> >>> -Jeff >>> >>> >>> >>>> Also, I'll see if it is possible to invert color scale and mask >>>> >>>> >> everything >> >> >>>> under a certain value >>>> >>>> Thanks very much for your help! >>>> >>>> Antoine De Pauw >>>> Collaborateur de recherches, Informatique - Research collaborator, IT >>>> Laboratoire de chimie quantique et photophysique - Quantum chemistry and >>>> photophysics laboratory >>>> Université Libre de Bruxelles - ULB >>>> >>>> >>>> -----Original Message----- >>>> From: Jeff Whitaker [mailto:js...@fa...] >>>> Sent: jeudi 11 septembre 2008 14:10 >>>> To: De Pauw Antoine >>>> Cc: 'Matplotlib Users' >>>> Subject: Re: [Matplotlib-users] Information request >>>> >>>> De Pauw Antoine wrote: >>>> >>>> >>>> >>>> >>>>> Hi Jeff, >>>>> >>>>> I have put the code online with a sample of the data here: >>>>> >>>>> http://snipplr.com/view/8307/map-plotting-python-code-temporary/ >>>>> >>>>> I hope you'll be able to give me some advice as it is quite difficult >>>>> >>>>> >> for >> >> >>>>> someone new in python and scientific computation >>>>> >>>>> Antoine De Pauw >>>>> Collaborateur de recherches, Informatique - Research collaborator, IT >>>>> Laboratoire de chimie quantique et photophysique - Quantum chemistry >>>>> > and > >>>>> photophysics laboratory >>>>> Université Libre de Bruxelles - ULB >>>>> >>>>> >>>>> >>>>> >>>>> >>>> Antoine: I may have the size of the pixels wrong, and lat/lon >>>> transposed, but this is the general idea: >>>> >>>> from mpl_toolkits.basemap import Basemap >>>> import matplotlib.pyplot as plt >>>> import numpy as np >>>> lats = []; lons = []; data = [] >>>> for line in open('pixels.dat'): >>>> linesplit = line.split(',') >>>> lons.append(float(linesplit[1])) >>>> lats.append(float(linesplit[0])) >>>> data.append(float(linesplit[2])) >>>> map = >>>> Basemap(projection='mill',llcrnrlat=min(lats)-5,urcrnrlat=max(lats)+5,\ >>>> >>>> urcrnrlon=max(lons)+5,llcrnrlon=min(lons)-5,resolution='l') >>>> x,y = map(lons,lats) >>>> plt.scatter(x,y,s=25,c=data,marker='s',edgecolor="None",cmap=plt.cm.jet) >>>> plt.colorbar(shrink=0.6) >>>> map.drawcoastlines() >>>> plt.show() >>>> >>>> -Jeff >>>> >>>> >>>> >>>> >>>> >>>>> -----Original Message----- >>>>> From: Jeff Whitaker [mailto:Jef...@no...] >>>>> Sent: mercredi 10 septembre 2008 16:45 >>>>> To: Antoine De Pauw >>>>> Cc: Matplotlib Users >>>>> Subject: Re: Information request >>>>> >>>>> Antoine De Pauw wrote: >>>>> >>>>> >>>>> >>>>> >>>>> >>>>>> Thanks Jeff, >>>>>> >>>>>> In fact my points are arranged in three unsorted arrays, with a simple >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>> scheme (thats why I couldn't plot them with imshow and others) >>>>> >>>>> >>>>> >>>>> >>>>> >>>>>> arrays: >>>>>> >>>>>> [lat][lon][val] >>>>>> [-10][ 17][0.3] >>>>>> [ 37][ 23][3.7] >>>>>> ... ... ... >>>>>> >>>>>> and so for many rows... >>>>>> >>>>>> what I have to do is looping through my arrays like that >>>>>> >>>>>> while i < rowcount: >>>>>> plot_to_map(lat[i],lon[i],val[i]) >>>>>> >>>>>> it is evidently an idea of how it could be done easily but my >>>>>> > knowledge > >>>>>> >>>>>> >>>>>> >>>>>> >>>> of >>>> >>>> >>>> >>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>> these libraries is too weak for me to figure out how to do it >>>>> >>>>> >>>>> >>>>> >>>>> >>>>>> my data comes from huge binary files but is extremely simple, so it >>>>>> >>>>>> >>>>>> >>> would >>> >>> >>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>> be really easy for anyone to help me as the problem itself is how to >>>>> > put > >>>>> unsorted points on the map with latitude and longitude coordinates >>>>> >>>>> >>>>> Antoine: You haven't said if your data forms a rectangular array. If >>>>> so, you can build a 2-d array from the input file and plot it with >>>>> imshow. If not, you can still plug the elements into a 2-d masked >>>>> array, leaving the missing pixels masked. You say the points are >>>>> 'unsorted', does that mean they are randomly distributed and do not >>>>> > form > >>>>> >>>>> >> >> >>>>> a rectangular grid? >>>>> >>>>> It would really be much easier to help if you gave us more information, >>>>> > > >>>>> such as how the data is structured, what the pixel footprint is, etc. >>>>> Perhaps you could post the binary file on an ftp site somewhere with >>>>> code to read it. >>>>> >>>>> Also, please hit 'reply all' when replying, so the matplotlib users >>>>> mailing list is CC'ed. >>>>> >>>>> -Jeff >>>>> >>>>> >>>>> >>>>> >>>>> >>>>>>> Antoine De Pauw wrote: >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>>> Sir, >>>>>>>> >>>>>>>> I'm sorry, as english is not my mothertongue and it is sometimes >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>> difficult to be understandable. >>>>> >>>>> >>>>> >>>>> >>>>> >>>>>>>> All is in the script I gave to you initially, except the point >>>>>>>> >>>>>>>> >> drawing >> >> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>> code which would be useless as it is proven not to work (I dont know >>>>> > the > >>>>> method to do it). >>>>> >>>>> >>>>> >>>>> >>>>> >>>>>>>> What I have is a map, and a set of pixels I have to put on it with >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>> geographic coordinates. >>>>> >>>>> >>>>> >>>>> >>>>> >>>>>>>> I cannot find the right method to put colour pixels on the map, >>>>>>>> >>>>>>>> >> that's >> >> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>> the problem. >>>>> >>>>> >>>>> >>>>> >>>>> >>>>>>>> I have that map in miller projection, and three arrays containing >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>> respectively latitude, longitude and satellite measured value. >>>>> >>>>> >>>>> >>>>> >>>>> >>>>>>>> What I need to obtain is something approximately like this: >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> > http://www.oma.be/BIRA-IASB/Molecules/SO2archive/info/background/so2sc200703 > >> >> >>> >>> >>> >>>> >>>> >>>> >>>> >>>>> _00_lr.gif but with the basemap toolkit. >>>>> >>>>> >>>>> >>>>> >>>>> >>>>>>>> So, my question is: how could I do to plot a coloured pixel at >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>> coordinates lat:lon on that map? If I have just the method to project a >>>>> geographic coordinate on the map and put a coloured pixel at the right >>>>> place, all is done and I just have to loop my arrays... Also, I would >>>>> >>>>> >>>>> >>> have >>> >>> >>> >>>>> to implement some antialiasing on the map. >>>>> >>>>> >>>>> >>>>> >>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>> Antoine: >>>>>>> >>>>>>> Are the pixels arranged on a regular grid - or are they randomly >>>>>>> distributed? If they are on a grid, it's easy (using pcolor or >>>>>>> >>>>>>> >>>>>>> >>> imshow). >>> >>> >>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>> >>>> >>>> >>>> >>>>>>> If you could send me your data I may be able to get you started. >>>>>>> >>>>>>> (I'm cc'ing the matplotlib list so others can join in the >>>>>>> > discussion). > >>>>>>> -Jeff >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>>> If this is not possible to do it in a simple and explainable way, >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>> please >>>> >>>> >>>> >>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>> tell me and I'll continue using matlab or searching for the bit of code >>>>> which will save me >>>>> >>>>> >>>>> >>>>> >>>>> >>>>>>>> Anyway, I have to thank you for your interest to help me.. >>>>>>>> >>>>>>>> Many thanks, >>>>>>>> >>>>>>>> Antoine De Pauw >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>>> Antoine De Pauw wrote: >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>>> Hi, and thanks for the answer >>>>>>>>>> >>>>>>>>>> In fact, what I do is reading a binary file to obtain 3 arrays >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>> (Lat,Lon,Val) describing geographic points which are associated by >>>>> > index > >>>>> (like point 1 is Lat[0]:Lon[0] with value Val[0]) >>>>> >>>>> >>>>> >>>>> >>>>> >>>>>>>>>> What I need to do is to plot some points on the map (miller >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>> projection >>>> >>>> >>>> >>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>> for most) based on latitude and longitude, to obtain a colour map >>>>> >>>>> >> (points >> >> >>>>> are unordered, it is from IASI satellite computations) >>>>> >>>>> >>>>> >>>>> >>>>> >>>>>>>>>> I'm able to create a map, draw simple things on it, etc but the >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>> problem I have is any method I try for plotting points is failing, >>>>> >>>>> >> either >> >> >>>>> pcolor, pcolormesh, imshow, etc. >>>>> >>>>> >>>>> >>>>> >>>>> >>>>>>>>>> When I found your post on that mailing list, I figured out that >>>>>>>>>> > you > >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>> might have the experience and skills to easily explain to me how to >>>>> manipulate these points and plot them on the map, as there's like no >>>>> >>>>> >> help >> >> >>>>> >>>>> >>>>> >>>>> >>>> on >>>> >>>> >>>> >>>> >>>>> the web except standard examples... >>>>> >>>>> >>>>> >>>>> >>>>> >>>>>>>>>> Please tell me if this is possible for you to give me some tips, >>>>>>>>>> > or > >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>> if >>>> >>>> >>>> >>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>> it takes too much of your time just advice me some lectures >>>>> >>>>> >>>>> >>>>> >>>>> >>>>>>>>>> Best regards, >>>>>>>>>> >>>>>>>>>> De Pauw Antoine >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>> Antoine: It would really help to have a script demonstrating your >>>>>>>>> problem. It sounds to me like you want to plot markers >>>>>>>>> > representing > >>>>>>>>> >>>>>>>>> >>>>>>>>> >>> a >>> >>> >>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>> >>>> >>>> >>>> >>>>>>>>> set of points - for that you should use the scatter method. >>>>>>>>> > pcolor, > >>>>>>>>> >>>>>>>>> >> >> >>>>>>>>> pcolormesh and friends are for plotting gridded data. >>>>>>>>> >>>>>>>>> -Jeff >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>>> De Pauw Antoine wrote: >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>>> Dear sir, >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> I’m currently trying to improve our plotting tools here at >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>> the >>>> >>>> >>>> >>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>> “Quantum >>>>> >>>>> >>>>> >>>>> >>>>> >>>>>>>>>>>> Chemistry and Photophysics” section of the Université >>>>>>>>>>>> > Libre > >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>> de >>>> >>>> >>>> >>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>>>>>>>>> Bruxelles, and I ran, after many time passed at searching for a >>>>>>>>>>>> solution, on an explanation from you here: >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>> http://www.nabble.com/Re:-matplotlib-basemap-question-tt17759370.html >>>>> >>>>> >>>>> >>>>> >>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> It seems that you could help me find a solution, as I cannot >>>>>>>>>>>> > plot > >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>> any >>>>> >>>>> >>>>> >>>>> >>>>> >>>>>>>>>>>> points on maps. >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> Could you please tell me what I could do to plot data in a >>>>>>>>>>>> > simple > >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>> way, >>>>> >>>>> >>>>> >>>>> >>>>> >>>>>>>>>>>> assuming I have 3 unordered arrays containing respectively >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>> latitude, >>>> >>>> >>>> >>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>>>>>>>>> longitude and values to plot? >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> Some tips would be very nice from you as any method I have tried >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>> so >>> >>> >>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>> far >>>>> >>>>> >>>>> >>>>> >>>>> >>>>>>>>>>>> give me some errors… >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> Thank you very much in advance, >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> Best regards, >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> PS: I give you the code I’m using currently, missing the >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>> plotting part >>>>> >>>>> >>>>> >>>>> >>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> from mpl_toolkits.basemap import Basemap >>>>>>>>>>>> >>>>>>>>>>>> from numpy import * >>>>>>>>>>>> >>>>>>>>>>>> from scipy.io.numpyio import fread >>>>>>>>>>>> >>>>>>>>>>>> import matplotlib.pyplot as plt >>>>>>>>>>>> >>>>>>>>>>>> import numpy as np >>>>>>>>>>>> >>>>>>>>>>>> import os >>>>>>>>>>>> >>>>>>>>>>>> import sys >>>>>>>>>>>> >>>>>>>>>>>> import array >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> fileName="c:/20080821.b56" >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> print('preparing map') >>>>>>>>>>>> >>>>>>>>>>>> map = >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> > Basemap(projection='mill',lat_0=0,lon_0=0,resolution='i',area_thresh=30000.) > >> >> >>> >>> >>> >>>> >>>> >>>> >>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>>>>>>>>> map.drawcoastlines(0.5,antialiased=1) >>>>>>>>>>>> >>>>>>>>>>>> map.drawmapboundary() >>>>>>>>>>>> >>>>>>>>>>>> #map.drawmeridians(np.arange(-180,180,60),linewidth=0.5, >>>>>>>>>>>> labels=np.arange(-180,180,60), labelstyle="+/-") >>>>>>>>>>>> >>>>>>>>>>>> #map.drawparallels(np.arange(-90,90,30), linewidth=0.5, >>>>>>>>>>>> labels=np.arange(-180,180,30), labelstyle="+/-") >>>>>>>>>>>> >>>>>>>>>>>> print('reading binary data') >>>>>>>>>>>> >>>>>>>>>>>> nbreligne=long(os.stat(fileName)[6])/(8*int(fileName[-2:])) >>>>>>>>>>>> >>>>>>>>>>>> Lat=zeros(nbreligne) >>>>>>>>>>>> >>>>>>>>>>>> Lon=zeros(nbreligne) >>>>>>>>>>>> >>>>>>>>>>>> Val=zeros(nbreligne) >>>>>>>>>>>> >>>>>>>>>>>> rawfile=fromfile(open(fileName,'rb'),'d',-1) >>>>>>>>>>>> >>>>>>>>>>>> Lat=rawfile[0:nbreligne] >>>>>>>>>>>> >>>>>>>>>>>> Lon=rawfile[nbreligne:nbreligne*2] >>>>>>>>>>>> >>>>>>>>>>>> Val=rawfile[nbreligne*21:nbreligne*22] >>>>>>>>>>>> >>>>>>>>>>>> print('shifting latitudes and projecting to map') >>>>>>>>>>>> >>>>>>>>>>>> i=0 >>>>>>>>>>>> >>>>>>>>>>>> while i < nbreligne: >>>>>>>>>>>> >>>>>>>>>>>> if(Lon[i]>180): >>>>>>>>>>>> >>>>>>>>>>>> print(Lon[i]) >>>>>>>>>>>> >>>>>>>>>>>> Lon[i]-=360 >>>>>>>>>>>> >>>>>>>>>>>> print(Lon[i]) >>>>>>>>>>>> >>>>>>>>>>>> i+=1 >>>>>>>>>>>> >>>>>>>>>>>> print('plotting data') >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> #plotting code comes here >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>> Antoine: If you send me a self-contained script that produces >>>>>>>>>>> > the > >>>>>>>>>>> >>>>>>>>>>> >> >> >>>>>>>>>>> problem you see, I can help you debug it. As it stands now, I >>>>>>>>>>> >>>>>>>>>>> >> have >> >> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>> very >>>>> >>>>> >>>>> >>>>> >>>>> >>>>>>>>>>> little to work with - it could be your plotting commands, or it >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>> could >>>> >>>> >>>> >>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>> be >>>>> >>>>> >>>>> >>>>> >>>>> >>>>>>>>>>> your data. >>>>>>>>>>> >>>>>>>>>>> -Jeff >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> print('saving map') >>>>>>>>>>>> >>>>>>>>>>>> plt.savefig("testfig.png",dpi=600) >>>>>>>>>>>> >>>>>>>>>>>> print('done') >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> *Antoine De Pauw* >>>>>>>>>>>> Collaborateur de recherches, Informatique - Research >>>>>>>>>>>> >>>>>>>>>>>> >> collaborator, >> >> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>> IT >>>>> >>>>> >>>>> >>>>> >>>>> >>>>>>>>>>>> Laboratoire de chimie quantique et photophysique - Quantum >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>> chemistry >>>> >>>> >>>> >>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>> and >>>>> >>>>> >>>>> >>>>> >>>>> >>>>>>>>>>>> photophysics laboratory >>>>>>>>>>>> *Université Libre de Bruxelles - ULB <http://ww.ulb.ac.be/>* >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>> -- >>>>>>>>>>> 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 >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>> -- >>>>>>>>> Jeffrey S. Whitaker Phone : (303)497-6313 >>>>>>>>> NOAA/OAR/CDC R/PSD1 FAX : (303)497-6449 >>>>>>>>> 325 Broadway Boulder, CO, USA 80305-3328 >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>> -- >>>>>>> Jeffrey S. Whitaker Phone : (303)497-6313 >>>>>>> NOAA/OAR/CDC R/PSD1 FAX : (303)497-6449 >>>>>>> 325 Broadway Boulder, CO, USA 80305-3328 >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>> >>>> >>>> >>>> >>> >>> >>> >> >> > > > -- Jeffrey S. Whitaker Phone : (303)497-6313 NOAA/OAR/CDC R/PSD1 FAX : (303)497-6449 325 Broadway Boulder, CO, USA 80305-3328