Re: [Matplotlib-users] [matplotlib-devel] Basemap r8403 and numpy 2.0
On Jun 10, 2010, at 1:30 PM, Christoph Gohlke wrote: > > > On 6/10/2010 10:14 AM, Pierre GM wrote: >> On Jun 10, 2010, at 12:51 PM, Jeff Whitaker wrote: >>> On 6/10/10 10:40 AM, Pierre GM wrote: >>>> All, >>>> Sorry, it's been a while since I've been using Basemap. I was just trying >>>> to update my local svn directory to r8403 and reinstall basemap, but an >>>> import fail w/ the following message: >>>> """ >>>> Traceback (most recent call last): >>>> File "", line 1, in >>>> File "~/basemap-dev/lib/mpl_toolkits/basemap/__init__.py", line 43, >>>> in >>>> import _geoslib, netcdftime >>>> File "_geoslib.pyx", line 13, in _geoslib (src/_geoslib.c:4014) >>>> ValueError: numpy.ndarray does not appear to be the correct type object >>>> """ >>>> I'm using numpy 2.0.0r8460 (development version). basemap can be >>>> successfully imported w/ the latest stable version, though. What am I >>>> doing wrong ? >>>> Thx in advance. >>>> P. >>>> >>> >>> Pierre: That should have been fixed with a recompile of the _geoslib C >>> extension Are you sure you deleted the build directory before reinstalling >>> basemap? >> > Try to regenerate the c files from _geod.pyx, _proj.pyx, and > _geoslib.pyx, using Cython-0.12.1. For example: That did the trick. Thanks a million, I would have spent far more time trying to find this one... -- ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] [matplotlib-devel] Basemap r8403 and numpy 2.0
On Jun 10, 2010, at 12:51 PM, Jeff Whitaker wrote: > On 6/10/10 10:40 AM, Pierre GM wrote: >> All, >> Sorry, it's been a while since I've been using Basemap. I was just trying to >> update my local svn directory to r8403 and reinstall basemap, but an import >> fail w/ the following message: >> """ >> Traceback (most recent call last): >> File "", line 1, in >> File "~/basemap-dev/lib/mpl_toolkits/basemap/__init__.py", line 43, >> in >> import _geoslib, netcdftime >> File "_geoslib.pyx", line 13, in _geoslib (src/_geoslib.c:4014) >> ValueError: numpy.ndarray does not appear to be the correct type object >> """ >> I'm using numpy 2.0.0r8460 (development version). basemap can be >> successfully imported w/ the latest stable version, though. What am I doing >> wrong ? >> Thx in advance. >> P. >> > > Pierre: That should have been fixed with a recompile of the _geoslib C > extension Are you sure you deleted the build directory before reinstalling > basemap? I did. Do I have to recompile geos ? It should be independent of numpy, right ? So I shouldn't have to touch it ? As far as I can tell, the setup picks up the proper versions of numpy and Python... -- ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Cant load file as an array.
On Oct 27, 2009, at 2:37 PM, Piter_ wrote: > Hi all. > I have a problem with loading file of following format: > first 1024 rows are tab delimited and contain from 2 to 256 elements > (in different files different number of columns) > after that 5 empty lines > and at the end some 20 text lines for description. With a recent SVN version of numpy, you can use the `skip_header` and `skip_footer` arguments of np.genfromtxt to skip lines at the beginning and the end of your file. In your case, you'd use `skip_header=0` and `skip_footer=5+20` P. -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] [matplotlib-devel] AutoDateFormatter/AutoDateLocator
On Oct 16, 2009, at 2:59 PM, Ryan May wrote: > On Wed, Oct 14, 2009 at 3:59 PM, John Hunter > wrote: >> I don't have a strong opinion on this -- making it more customizable >> is a good thing -- this came up at scipy as well, where I contributed >> a patch to make the AutoDateFormatter a little more customizable by >> exposing a scaled dictionary mapping the scale to a format string. >> As >> long as the extension to the AutoDateLocator preserves the core >> functionality, I say have at it. > > Here's a patch that implements the ideas I have. To the best of my > ability, it preserves the same behavior as before, it just opens it up > to configuration by the user instead of being hard-coded. It adds: > > 1) Configuring the minimum number of ticks, which determines whether > to do yearly, monthly, etc. ticking > > 2) Configuring the maximum number of ticks, which is used to select > what interval of ticking to use. This is actually > done on a per-frequency basis. This helps to keep in line with > previous behavior and is useful for keeping tick spacing in line with > what the label would be for a given frequency. The user can also > simply pass an integer that > gives the maximum for all frequencies. > > 3) A dictionary of intervals corresponding to each frequency. This > keeps the previous functionality of appropriate intervals for each > frequency, but also opens it up to user configuration. > > 4) Optional ticking on multiples of the interval. Previously, if you > were ticking with, say, 10 minute intervals, and the range happened to > start at 33 minutes, you'd get ticks at 33, 43, 53, etc. With this > flag set, the ticks instead end up at 40, 50, 0, 10, etc. > > I'd appreciate anyone looking this over for any glaring problems > before I check this in. I've done my best to preserve old > functionality, though I'm still working on getting the unit tests to > run here. It also passes my own testing here when I fiddle with the > new knobs that have been exposed. My one question is: how important > is keeping API compatibility? The constructor tries to follow the > convention of the rest of the module (tz is last or nearly so), but > this breaks compatibility (where tz was the only argument). Also, to > me, it would be nice to tick multiples of the interval by default. > > Thoughts? Have you checked scikits.timeseries.lib.plotlib ? We provide some functions that adapt the ticks to the frequency of you base series, but also according to the range of the axes. For example, if you work with a 100-y daily timeseries, you'll have major ticks every 5 years if you plot the whole series, every month if you plot or zoom on one year only, etc. it may be worthwhile to give it a try. I'd be happy to help adapting our code to remove the dependency on scikits.timeseries if needed... -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Cocoa Backend on Snow Leopard
On Sep 19, 2009, at 12:55 PM, Pierre GM wrote: > All, > I'm trying to use the Cocoa backend on Snow Leopard, using r7791 > (GCC 4.2.1 / Python 2.6.1 from Apple, 64b) > Unfortunately, a simple `plot(range(10),range(10))` gives me an > empty window and error message as such: > > Python[53010:d07] Inconsistent set of values to create > NSBitmapImageRep > /Users/pierregm/.local/lib/python2.6/site-packages/matplotlib/ > backends/backend_cocoaagg.py:140: UninitializedDeallocWarning: > leaking an uninitialized object of type NSBitmapImageRep > 32) # bits per pixel > > Can anybody reproduce it ? Would anybody have some ideas on how to > fix that ? > Thx a lot in advance. > P. > FYI, the build log can be accessed at: http://pastebin.com/d5b3c1838 I'm very, very sorry to bump my own thread, but I'm in a bit of a pickle. Matplotlib installs and runs nicely on my Snow Leopard installation, but I'm "blind": cocoa fails, wxpython is 32b only and compiling Qt4 is becoming increasingly frustrating on a 64b machine. Any help or hint would be really, really appreciated. (and once again, sorry for my being rude) P. -- Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Cocoa Backend on Snow Leopard
All, I'm trying to use the Cocoa backend on Snow Leopard, using r7791 (GCC 4.2.1 / Python 2.6.1 from Apple, 64b) Unfortunately, a simple `plot(range(10),range(10))` gives me an empty window and error message as such: Python[53010:d07] Inconsistent set of values to create NSBitmapImageRep /Users/pierregm/.local/lib/python2.6/site-packages/matplotlib/backends/ backend_cocoaagg.py:140: UninitializedDeallocWarning: leaking an uninitialized object of type NSBitmapImageRep 32) # bits per pixel Can anybody reproduce it ? Would anybody have some ideas on how to fix that ? Thx a lot in advance. P. FYI, the build log can be accessed at: http://pastebin.com/d5b3c1838 -- Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] setting axis limits
On Jul 15, 2009, at 6:54 PM, Dr. Phillip M. Feldman wrote: > leaving the x-axis alone, or vice versa, or set a lower limit for > the y-axis > but leave the upper limit alone. Is there a clean way of doing > this? (I > have not been able to find anything relevant in the Matplotlib Users > Guide). Please check set_xlim and set_ylim. -- Enter the BlackBerry Developer Challenge This is your chance to win up to $100,000 in prizes! For a limited time, vendors submitting new applications to BlackBerry App World(TM) will have the opportunity to enter the BlackBerry Developer Challenge. See full prize details at: http://p.sf.net/sfu/Challenge ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] [matplotlib-devel] crazy ideas for MPL
Eh, can I play ? * Something I'd really like to see is a way to access a given patch/ line/collection/... by a string (a name) instead of having to find the corresponding element in a list. That would mean converting lists into dictionaries, or at least provide a way to map the list to a dictionary. An example of application would be "del lines['first']" to delete the line named 'first'. By default, if no name is explicitly given to an object, we could use the order in which it is drawn... -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Basemap & ax parameter : bug or feature ?
On Jun 23, 2009, at 6:01 PM, Jeff Whitaker wrote: >> > Pierre: Doing what you suggest (having Basemap.__init__ > automatically set self.ax to the current axes) will break pickling, > so I can't do that. Oh, I'm sorry for the misunderstanding: I never suggested that Basemap.ax should be set at creation (apart from Basemap.ax=None). Instead, I suggested that it would be set when a drawing method is called that requires access to the underlying Axes (basically, all the plotting methods). That way, as soon as something is plotted, we associate the basemap instance with one particular Axes instance and we stick to it by default. We can always break the link by changing basemap.ax (that is, associate to another Axes instance), but we don't have the surprise of using the last Axes instance by default. Now, the more I think about it, the more I'd prefer to separate Basemaps from Axes. Right now, self.ax assures the connection in a way I find frustrating. I'd prefer getting rid of Basemap.ax and force 'ax' to be defined all the time. Alternatively, we could consider having 2 separate objects: a Basemap that stores all the projection information but has *NO* plotting methods, and a MapAxes that inherits from Axes and requires a specific Basemap attribute at creation. The current plotting routines would be associated with the MapAxes object. -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Basemap & ax parameter : bug or feature ?
All (and Jeff W. in particular), It's the time of the year where I have to draw maps in batch. I wrote a script to process some data recorded at various stations, interpolate the data on a grid, draw the corresponding contours on a basemap, add a colorbar, and end with adding some extra information on the map (scale, stations positions...). Nothing too fancy, but I ran into a problem with the last few steps. As I do not give an explicit 'ax' parameter to any of the basemap related methods (.contourf, .plot, .drawmapscale...), I have to rely on the defaults: use self.ax if it is not None, gca() otherwise. However, drawing a colorbar in midprocess switches the focus to the colorbar, and the extra information I was talking about gets plotted on the colorbar. Which brings me to the famous question: is it a bug or a feature ? Is there any rational in *not* setting the 'ax' attribute to gca() when sit hasn't been set yet and no 'ax' parameter has been specifically given as input of a method ? Thanks a lot in advance for any explanation: P. [As a workaround, I modified my local sources by adding a ._check_ax method as below, and used : ax = ax or self._check_ax(ax) or ax = kwargs.pop('ax', None) or self._check_ax() depending on the context def _check_ax(self, ax=None): """ Returns the axis on which to draw. By default, returns self.ax. If this latter is None, set it to gca(). """ # if ax is None: if self.ax is None: try: ax = plt.gca() except: import matplotlib.pyplot as plt ax = plt.gca() self.ax = ax return self.ax return ax -- Are you an open source citizen? Join us for the Open Source Bridge conference! Portland, OR, June 17-19. Two days of sessions, one day of unconference: $250. Need another reason to go? 24-hour hacker lounge. Register today! http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] NOAA .bull file parsing
Anton, You may wanna check on the numpy list as well. I recently reimplemented a function to read text file as a combination of numpy.loadtxt and mlab.csv2rec, that handles missing data nicely. You can get it here for the moment: https://code.launchpad.net/~pierregm/numpy/numpy_addons The function you would need is mafromtxt, in fromascii. Alternatively, you can try using the scikits.timeseries package (http://pytseries.sourceforge.net/ ): recent SVN versions introduced tsfromtxt, that read a text file and return a timeseries. However, none of these possibilities will work out-of-the-box, because of the presence of the footer. What you could do is write a first function that gets rid of this footer (example of MO: open the file, read all the lines in a list, get rid of the first 7 rows (header) and last 8 ones, store the result in a file). Once you have only the data, use mafromtxt (for example) using space as a delimiter, and specify the columns you want to use with usecols (that way, you can get rid of the column with the '*'). The missing data should be taken into account properly. Let me know how it goes. P. On Jan 17, 2009, at 2:16 AM, antonv wrote: > > Dear all, > > I know this is not related to matplotlib but this seems to be the > only place > where I found people that have knowledge of both NOAA data and > python so > please bear with me. > > The .bull file that NOAA gives for upload is an ascii file formatted > for > human readability but it creates a lot of issues when I am trying to > parse > it. Here is a link to one of these files: > > ftp://ftpprd.ncep.noaa.gov/pub/data/nccf/com/wave/prod/wave.20090117/bulls.t00z/akw.46001.bull > > Do you have any idea on how to extract the data there in columns for > plotting with matplotlib? If you look at the file you'll notice that > there > is both a header and a footer for the file that needs to be > eliminated and > the main columns have sub columns also. Another issue is that in a > column > there is missing data that should keep it's relationship with the time > column. And the last issue, some of the values there are preceded by > a "*" > sign that should just be removed too. > > Any ideas are greatly appreciated! > > Anton > > -- > View this message in context: > http://www.nabble.com/NOAA-.bull-file-parsing-tp21513800p21513800.html > Sent from the matplotlib - users mailing list archive at Nabble.com. > > > -- > This SF.net email is sponsored by: > SourcForge Community > SourceForge wants to tell your story. > http://p.sf.net/sfu/sf-spreadtheword > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] csv2rec column names
FYI, I recoded np.loadtxt to handle missing data, automatic name definition and conversion functions, as a merge of np.loadtxt and mlab.csv2rec. You can access the code here: https://code.launchpad.net/~pierregm/numpy/numpy_addons Hopefully these functions will make it to numpy at one point or another. Note also that you are not limited to recarrays: you can use what's called a flexible-type arrays, which still gives the possibility to access individual fields by keys, without the overload of recarrays (where fields can also be accessed as attributes). For example: >>> x=np.array([(1,10.), (2,20.)], dtype=[('A',int),('B',float)]) >>>x['A'] array([1, 2]) On Jan 3, 2009, at 12:59 PM, Patrick Marsh wrote: > In my limited opinion, numpy's loadtxt is the way to go. Loadtxt > doesn't care about the headerYou can read in the arrays like this: > > # read in all 5 columns as text > col1, col2, col3, col4, col5 = np.loadtxt(filename, dtype=dtype, > unpack=True) > > or if you want to skip the column headings and read in just a specific > data type of just the last column > > # read in only column 5, as a specific dtype, and exclude the column > 5 heading > col5_no_header = np.loadtxt(filename, skiprows=1, usecols=(5), > dtype=dtype, unpack=True) > > > -Patrick > > > > > > > On Sat, Jan 3, 2009 at 11:39 AM, antonv > wrote: >> >> I am plotting the data in those csv files and the forst 4 columns >> in the >> files have the same title but the 5th has the name based on the >> date and >> time so it would be unique in each of the files. As I have about >> 600 files >> to batch process, adjusting my script manually is not an option. >> >> The way I have it for one test file is: >> >> r = mlab.csv2rec('test.csv') >> #i know that the column name for the 5th column is 'htsgw_12191800' >> #so to read the data in the 5th column i just use: >> z = r.htsgw_12191800 >> >> What i need is to be able to get that data by specifying the column >> number >> as that stays the same in all files. >> >> I'll look at numpy but I hope there is a simpler way. >> >> Thanks, >> Anton >> >> >> >> Patrick Marsh-2 wrote: >>> >>> I'm not sure what you are needing it for, but I would suggest >>> looking >>> into numpy's loadtxt function. You can use this to load the csv >>> data >>> into numpy arrays and pass the resulting arrays arround. >>> >>> -Patrick >>> >>> >>> >>> >>> >>> >>> On Sat, Jan 3, 2009 at 11:21 AM, antonv >>> wrote: Hi all, I have a lot of csv files to process, all of them with the same number of columns. The only issue is that each file has a unique column name for the fourth column. All the csv2rec examples I found are using the r.column_name format to access the data in that column which is of no use for me because of the unique names. Is there a way to access that data using the column number? I bet this should be something simple but I cannot figure it out... Thanks in advance, Anton -- View this message in context: http://www.nabble.com/csv2rec-column-names-tp21267055p21267055.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users >>> >>> -- >>> ___ >>> Matplotlib-users mailing list >>> Matplotlib-users@lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >>> >>> >> >> -- >> View this message in context: >> http://www.nabble.com/csv2rec-column-names-tp21267055p21267232.html >> Sent from the matplotlib - users mailing list archive at Nabble.com. >> >> >> -- >> ___ >> Matplotlib-users mailing list >> Matplotlib-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> > > -- > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] How do I increase the left-margin of pylab plots?
On Dec 8, 2008, at 1:09 AM, Roy H. Han wrote: > I figured it out. > Specifically, I need to use pylab.Axes(figure, [left, bottom, width, > height]) where each value in the frame is between 0 and 1 > [.2,.1,.7,.8] > means > 20 percent margin on left > 10 percent margin on bottom > 10 percent margin on right (1 - .2 - .7) > 10 percent margin on top (1 - .1 - .8) Yep, you got it. Now, you can also use the simpler `pyplot.subplots_adjust` as a function, or as a method for your figure. That way, you're not tied to defining the positions at the creation of your subplot. -- SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Masking with patches
Søren, Why wouldn't you allocate a 'zorder' to each mask, corresponding to a layer nb. That way, if a same pixel is shared by 2 masks or more, you take the one with the highest zorder. That could be done as easily as definind a `maskstack` list, with element `i` the mask with zorder `i`. Now, the global mask is simply np.logical_or.reduce(maskstack). That way, you could leave any masked data in the original dataset alone and not mix it with your stack of patches. Let me know how it goes. On Wednesday 29 October 2008 21:10:34 Søren Nielsen wrote: > Hi, > > I'm making a masking function that can mask out certain areas of an image > using different types of masks, and display them using patches. I want to > add a function where a user can move a mask that has already been created. > > I can use the picker = True to have it return the patch being clicked on.. > but how do I know which mask was clicked on if I have two identical masks? > or even worse, if I have two identical masks almost lying ontop of each > other.. returning both patches at the same time?? I've tried different > things using == to compare.. but that didn't work.. any suggestions?? > > Soren - 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 Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] How to plot only points which lie in a certain range
On Monday 27 October 2008 18:40:07 marcusantonius wrote: > I'm sorry for this newbie question. I have a data file consisting of 3 > columns, and want to plot the first versus the second column, but only if > the parameter in the third column lies in a certain range. Does somebody > have an idea how to do that? Using masked arrays ? import numpy as np import numpy as ma import matplotlib.pyplot as mpl x = ma.arange(10) y = ma.array(np.random.rand(10)) z = ma.array(np.random.rand(10)) (z_lo, z_up) = (0.1, 0.8) x[ (zz_up) ] = ma.masked mpl.plot(x,y, 'ok-') Alternatively, x = ma.masked_where((zz_up), x) - 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 Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] how to tell if a point is inside a polygon
Mathew, Have you tried the solution that was suggested by Angus yesterday on the numpy mailing list ? http://projects.scipy.org/pipermail/scipy-user/2008-February/015418.html >>> import numpy as np >>> import matplotlib.nxutils as nxutils >>> polygon=np.array([(0,0),(0,1),(1,1),(1,0)]) >>> points = np.array([(0.5,0.5),(0.4,1.5)]) >>> nxutils.points_inside_poly(points, polygon) array([1, 0], dtype=int32) Meaning that the first point is, the second is not. - 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 Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] some numpy help for clipping rows/column of masked data
Marjolaine, Getting rid of rows/columns in your case might be a bit tricky, as there's nothing to ensure that your domain is actually square. First, create your mask: lon_mask = (lon >= min_lon) & (lon <= max_lon) lat_mask = (lat >= min_lat) & (lat <= max_lat) glb_mask = lon_mask & lat_mask glb_mask is 2D, with True where the data is selected and False otherwise. Of course, that'll only work if the initial arrays have the same shape. Now, you can check whether all the rows are False (no data selected) row_clipper = glb_mask.any(axis=1) row_clipper is 1D, with the same length as glb_mask, and False where now data is selectd and True otherwise: we can use row_clipper to select only the rows that have at least one unmasked data: clipped_rows = original_array[row_clipper] Then, rinse and repeat, this time on the columns: col_clipper = glb_mask.any(axis=0) clipped_cols = clipped_rows.T[col_clipper].T Note the double .T. You can also decide to use .all instead of any, to select the rows/cols where all data are valid. Let us know how it works. P. On Friday 12 September 2008 10:02:56 Marjolaine Rouault wrote: > Hi, > > I was wondering if the matplotlib users would be able to help with a numpy > problem. > > I have 2 dimensional arrays of latitudes and longitude named lon and lat > and only want to extract lats and lons within a certain domain > It is easy to apply the mask > > lonMask = (lon >= minLon) & (lon <= maxLon) > latMask = (lat >= minLat) & (lat <= maxLat) > > MyNewArray = putmask(originalArray,lonMask*latMask) > > But I am not sure how to clip rows and column of mask data to reduce size > of resulting array. > > The compress, extract etc functions all seem to work with 1D arrays and I > don;t know how to get from my 1D array back to a 2D array. > > I hope this is making sense. > > Marjolaine. - 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 Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] plotting array with inf
On Wednesday 06 August 2008 09:24:18 Michael Droettboom wrote: > (I don't know if the > new masked arrays have a C API we could use -- the old ones apparently > didn't.) They don't. I thought about it before, but decided to forget about it until I could find a job where I could learn C and focus exclusively on that for a few months. Unlikely anytime soon. - 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 Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Numpy 1.1 error
On Saturday 07 June 2008 16:04:13 Samuel M. Smith wrote: > Numpy is installed in /Library/Frameworks/Python.framework/Versions/ > 2.5/lib/python2.5/site-packages/numpy > Numpy version 1.1.0 > /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site- > packages/numpy/core/ma.py:609: UserWarning: Cannot automatically > convert masked array to numeric because data > is masked in one or more locations. >warnings.warn("Cannot automatically convert masked array to "\ Samuel, Something must be wrong with your numpy installation: did you forget to delete any previous installation of numpy before installing 1.1.0 ? There shouldn't be any ma.py module in numpy.core. The masked array module now resides in numpy.ma > FAIL: check_testUfuncRegression (numpy.core.tests.test_ma.TestUfuncs) Same here: you shouldn't have a numpy.core.tests.test_ma file, but numpy.ma.tests.test_core. Please try to reinstall numpy from scratch, or at least delete outdated files. - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Fwd: speed of clearing and creating a new array
On Tuesday 08 April 2008 10:46:32 Bryan Fodness wrote: > I am starting with a zero array, populate it according to some > condition, save the graph, and then reset the array to zero. Can > someone tell me if there is a better (faster) way to do this? My 2c: * Use inplace addition to save some space while something: if something: if something: a[y,x] += 1 * To set all the values to 0: a.flat = 0 - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Register now and save $200. Hurry, offer ends at 11:59 p.m., Monday, April 7! Use priority code J8TLD2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] plotting from a dictionary
Chris, Why wouldn't you try to use sorted on your dictionary, construct an array from the result of sorted, and get the corresponding columns ? >>>ddict={date(2008,01,01):10,date(2008,01,03):20,date(2008,01,02):30} >>>results=numpy.array(sorted(ddict.iteritems()),) >>>print results[:,0] >>>[2008-01-01 2008-01-02 2008-01-03] >>>print results[:,1] >>>[10 30 20] - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Loading and saving arbitrary objects with attributes
On Wednesday 26 March 2008 07:16:37 Troels Kofoed Jacobsen wrote: > Hi. > > Does anyone know how to save and load an arbitrary object (e.g a numpy > array) to a file, and load it again? Have you tried to pickle your object w/ cPickle ? - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] plotting filled lines with missing data?
Chris, My 2c: Your data is indexed in time, right ? Your x-axis is a date object ? Then use scikits.timeseries http://scipy.org/scipy/scikits/wiki/TimeSeries That package was designed to take missing dates/data into account. That way, you can plot your data with the gaps already taken into account: we have written a specific matplotlib interface, you'll find the details following the link above. I must admit we didn't implement poly_between for timeseries. Most likely, we'd have to implement it for regular masked arrays first, as mentioned by Eric. What you could do is to fill your array with some kind of baseline, such as 0, or your minimum data, or wtvr. That's just a quick trick and no fix. - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] plotting with missing data?
On Tuesday 18 March 2008 16:17:08 Eric Firing wrote: > Chris Withers wrote: > > Eric Firing wrote: > You should use numpy.masked_where(numpy.isnan(aa), aa). or use masked_invalid directly (shortcut to masked_where((isnan(aa) | isinf(aa)) > > I only wish that masked_equal didn't blow up when aa contains datetime > > objects :-( Could you send me an example of the kind of data you're using ? As it seems you're dealing with series indexed in time, you may want to try scikits.timeseries, a package Matt Knox and myself implemented for that very reason. - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Masking data problems and fill test
Michael, Give scikits.timeseries a try. It's a package designed to handle time series, with or without missing data or dates, for which matplotlib functions are also available. http://scipy.org/scipy/scikits/wiki/TimeSeries The problem you're refering to (missing dates) is trivial with this package. Let me know if you have any problem with it. Please note that plotting with hourly frequency is still experimental (and we need some feedback). HIH P. - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] delete instance of axvspan
On Tuesday 12 February 2008 12:07:21 Michael Frauens wrote: > I am using span selector to identify an area and then highlight in in > green. I want the user to be able to validate this (or not) and then > select another area (or not). However, when the user selects the alternate > area I want the previous instance of axvspan to be deleted/removed. How do > I remove this instance? of do I have to delete the whole plot and replot? > > Removing the instance is strongly preferred becauase the user may of > altered the display using the canvas widgets. Michael, I have more or less the same issue: I need to be able to highlight one particular curve among many. I have implemented a special subclass of Axes for my particular problem. This subclass has a method "highlight" Here's a rough draft of what I do: def __init__(self,*args,**kwargs) Subplot.__init__(self,*args,**kwargs) sefl.highlightedfreq = None def highlight(bandwidth, **options): if (self.highlightedfreq is not None) and \ (self.highlightedfreq != bandwidth): del self.lines[self.highlightedline] self.highlightedfreq = bandwidth self.plot(current._dates-shift, current._series, lw=lw, ls=ls, c=c, scalex=False, scaley=False) self.highlightedline = len(self.lines)-1# return self.highlightedline As you see, I have an extra attribute (highlightedfreq) that stores the index of the highlighted line: when I need to deselect the highlighted curve, I just delete the corresponding element of the lines list. HIH P. - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] interrupted line with maskedarray (normal behavior ?)
On Sunday 10 February 2008 13:23:13 David Trémouilles wrote: > Thank you very much Pierre! > You made me discover boolean index (numpy is fantastic !) > In the mean time, I now understand the purpose of maskedarray that I > totally missed at a first sight. You're quite welcome. Masked arrays are great when you need a way to flag invalid or missing data. For simpler cases, boolean indexing can be faster and easier to understand. And now, for a shameless plug: if you work with series indexed with time, you might be interested in the timeseries package (available as a scikit in http://svn.scipy.org/svn/scikits/trunk/timeseries/). The package relies on the new numpy.ma package. - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] interrupted line with maskedarray (normal behavior ?)
On Sunday 10 February 2008 12:40:38 David Trémouilles wrote: > I have a slightly different objective: I just want to remove outliers > from my curves. I think I will still play with maskedarray and used the > compressed() function before 'sending' to matplotlib. > Any comments on that, any other idea? So, you have two arrays x and y, with missing values in y that you don't want to plot ? Assuming that your arrays are 1D, you can try something like: plot(x[logical_not(y.mask)], y.compressed()) in order to ensure that the x and y to be plotted have the same size. Note that in this simple case, you don't need masked arrays, you just want to plot point satisfying a given condition, right ? So: condition = (y>=min_value) & (y<= max_value) plot(x[condition],y[condition]) will give the same results. - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] histogram
On Monday 04 February 2008 12:28:21 jlu wrote: > Are there any plans to add to hist() the ability to do non-bar style > histograms? I mean something like the following: What about using plot w/ linestyle='steps' ? Or change the linewidth to 0 in bar - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] matplotlib.toolkits.basemap. Basemap overlays?
On Wednesday 23 January 2008 14:57:26 Jim Vickroy wrote: > Hello users, > > I'm using matplotlib.toolkits.basemap.Basemap to plot data on several > types of projections at a regular cadence. I am presently regenerating > the maps each time new data is to be plotted. Is it possible to > generate template map projections once (at startup) and reuse them each > time new data is to be plotted? If so, could someone point to a > reference or example of how to do this? You could try to pickle the basemap instance, that should save you some initialization time. Then, it's just a matter of replotting. - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Basemap questions
On Friday 02 November 2007 15:10:15 Michael Hearne wrote: > Is there an easy way to do this with matplotlib/basemap tools? I'm afraid that not. Your problem is that you need to find for each cell of your gridded data whether you are on land or in an ocean, and mask the corresponding cell in the latter case. Such a manipulation of geometry is not available in matplotlib (yet, and will it ever be?). You could of course start writing your tests. However, that's exactly what OGR is designed to do, and the couple of functions I sent earlier can be quite helpful. Once again, OGR is part of the GDAL suite. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Basemap questions
On Friday 02 November 2007 11:51:55 Michael Hearne wrote: > 2) Has anyone figured out a way to make an _ocean_ mask? I need my > map to look like this Assuming that you have gdal installed, you can use this set of functions. Basically, you use OGR to compute the differences between the background and the land polygons... Works fine for my applications (I interpolate some rainfall fields over AL/GA/FL, and need to hide the interpolated values in the Gulf of Mexico), but might still be a tad buggy. Please don't hesittate to contact me if you need help with that. #-- # --- OGR conversion --- #-- import ogr def polygon_to_geometry(polygon): """Creates a new ogr.Geometry object from a matplolib.Polygon.""" if not isinstance(polygon, Polygon): raise TypeError, "The input data should be a valid Polygon object!" listvert = ["%s %s" % (x,y) for (x,y) in polygon.get_verts()] listvert.append(listvert[0]) return ogr.CreateGeometryFromWkt("POLYGON ((%s))" % ','.join(listvert)) #- # OGR to matplotlib --- #- def _geometry_to_vertices(geometry): """Creates a list of vertices (x,y) from the current geometry.""" verts = [] for nl in range(geometry.GetGeometryCount()): line = geometry.GetGeometryRef(nl) points = [(line.GetX(i), line.GetY(i)) for i in range(line.GetPointCount())] verts.append(points) return verts def geometry_to_vertices(geometry): """Creates lists of vertices (x,y) from the current geometry.""" if not isinstance(geometry, ogr.Geometry): raise TypeError, "The input data should be a valid ogr.Geometry object!" vertices = [] # if geometry.GetGeometryType() == ogr.wkbPolygon: vertices.extend(_geometry_to_vertices(geometry)) elif geometry.GetGeometryType() == ogr.wkbMultiPolygon: for np in range(geometry.GetGeometryCount()): poly = geometry.GetGeometryRef(np) vertices.extend(_geometry_to_vertices(poly)) return vertices #-- # --- Add-ons #-- def fillwaterbodies(basemap, color='blue', inlands=True, ax=None, zorder=None): """Fills the water bodies with color. If inlands is True, inland water bodies are also filled. :Inputs: basemap : Basemap The basemap on which to fill. color : string/RGBA tuple *['blue']* Filling color inlands : boolean *[True]* Whether inland water bodies should be filled. ax : Axes instance *[None]* Axe on which to plot. If None, the current axe is selected. zorder : integer *[None]* zorder of the water bodies polygons. """ if not isinstance(basemap, Basemap): raise TypeError, "The input basemap should be a valid Basemap object!" # if ax is None and basemap.ax is None: try: ax = pylab.gca() except: import pylab ax = pylab.gca() # coastpolygons = basemap.coastpolygons coastpolygontypes = basemap.coastpolygontypes (llx, lly) = (basemap.llcrnrx, basemap.llcrnry) (urx, ury) = (basemap.urcrnrx,basemap.urcrnry) background = Polygon([(llx, lly), (urx, lly), (urx, ury), (llx, ury)]) # ogr_background = polygon_to_geometry(background) inland_polygons = [] # for (poly, polytype) in zip(coastpolygons, coastpolygontypes): if polytype != 2: verts = ["%s %s" % (x,y) for (x,y) in zip(*poly)] ogr_poly = ogr.CreateGeometryFromWkt("POLYGON ((%s))" % ','.join(verts)) ogr_background = ogr_background.Difference(ogr_poly) else: inland_polygons.append(Polygon(zip(*poly), facecolor=color, edgecolor=color, linewidth=0)) # background = geometry_to_vertices(ogr_background) for xy in background: patch = Polygon(xy, facecolor=color, edgecolor=color, linewidth=0) if zorder is not None: patch.set_zorder(zorder) ax.add_patch(patch) # if inlands: for poly in inland_polygons: if zorder is not None: poly.set_zorder(zorder) ax.add_patch(poly) basemap.set_axes_limits(ax=ax) return - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration file
Re: [Matplotlib-users] Plotting 3D skymap surfaces
On Tuesday 09 October 2007 20:08:29 Adam Mercer wrote: > On 09/10/2007, Jeff Whitaker <[EMAIL PROTECTED]> wrote: > > Adam: If you can convert your coordinates into latitudes and > > longitudes, then you can plot the data with the basemap tookit on your > > choice of map projection (see > > http://www.scipy.org/Cookbook/Matplotlib/Maps for an example). > > Following that example I'm running into a few problems, this is the code I > have: Gonna assume that values is a 1D array, right ? I'm pretty sure that you need a 2D array for contours to work. http://www.scipy.org/Cookbook/Matplotlib/Gridding_irregularly_spaced_data - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] inverted x-axis
On Tuesday 04 September 2007 17:53:56 Johann Cohen-Tanugi wrote: > Jouni, > thanks for your reply. > I could test that > plot([1,2,3],[1,2,3]) > setp(gca(), 'xlim', (3.0,1.0)) > works, > but > setp(gca(), 'xlim', reversed(getp(gca(), 'xlim'))) Johann, You may find it easier to use methods instead of functions: gca().set_xlim(gca().get_xlim()[::-1]) Note the [::-1], that will reverse your tuple. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Plotting incomplete data sets
On Wednesday 29 August 2007 10:02:14 John Morgan wrote: > I have some data, which I'd like to plot using matplotlib. Some of the data > has been flagged by some other software, and I have a boolean array, the > same shape as my original data which tells me which data has been flagged > > I'm sure I can get this approach to work but I thought I'd ask if there's > there a more elegant way to achieve the same aim. two words: masked arrays. >>>import numpy >>>flagged = numpy.ma(initial_array, mask=boolean_array) >>>plot(flagged) That will take care of the unmasked data. For the masked values, just revert the mask. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Filtering plots
On Wednesday 18 July 2007 07:11:04 Darren Dale wrote: > Here is another way, with numpy arrays: > > data[data==0]=nan My 2c: That won't work if data is int_, as nan will be treated as 0. I'm fairly partial to masked arrays... - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] ytick label format
On Sunday 24 June 2007 20:45:09 Rodrigo López Negrete de la Fuente wrote: > I've been trying to generate certain plots, but sometimes I get strange > additions to the yticks in the plots. I've been wondering if there is a way > to force matplotlib to not do that, and only use multiplicative corrections > to the plots (i.e., just the x1e-3 for example and not the +4.519x10). Rodrigo, This behaviour is controlled by the formatter of the yaxis. Choose one formatter that suits you, or define your own. More info: http://matplotlib.sourceforge.net/matplotlib.ticker.html examples/newscalarformatter_demo.py - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] A collection of axvspan ?
On Thursday 21 June 2007 17:15:01 Eric Firing wrote: > trans = blend_xy_sep_transform( self.transData, self.transAxes ) > > where "self" in this case is the axes instance, so you would use "ax" or > whatever. Then, since the collection is an artist, you can use its > inherited set_transform(trans) method, John, Eric, That works like a charm ! Thanks a lot ! - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] A collection of axvspan ?
All, I need to plot stripes of different widths at different locations along the x axis, but spanning the whole range of y data. Using axvspan in a loop works quite fine. However, I was wondering whether it wouldn't be more efficient to build a PatchCollection. BrokenBarHCollection could be a candidate, but I have trouble figuring how to force the bars to span the whole range of y: is it possible to force the ordinates to axes coordinates ? Thanks a lot in advance for any idea/comment P. - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] index out of bounds if X not equals to y
On Wednesday 11 April 2007 03:28:09 elekis wrote: Hi, Just some quick comments: 1. learn list comprehensions, they're far faster than regular loops. data = [(i,j,int(numpy.random.random()*10)) for i in range(XI) for j in range(JI)] 2. if you don't really need the triplets, but just the random part, just use: Z = (numpy.random.random(XI*YI)*10).astype(int).reshape(Xl,Yl) 3. It's more efficient to use numpy.empty than numpy.zeros to initialize an array you're going to fill afterwards. 4. You may have found a bug in plot_wireframe, actually. The code doesn't look quite right. My understanding is that the 3d part is not really supported, either... Hope it helps. - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] date demo1 not working for me
On Tuesday 27 March 2007 16:27:35 C M wrote: > ValueError: time data did not match format: data=2003-12-01 fmt=%d-%b-%y > > Any idea what I'm doing wrong? Well, if data='2003-12-01', the format should be "%y-%m-%d" or "%y-%d-%m" depending on the local convention. Here, 2003 is interpreted as a day, which of course doesn't work. - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Masked array problem in python 2.4.4 -SOLVED
The problem was a use of (Numeric) MA with numpy. Pointing towards matplotlib.numerix.ma solved the issue. - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Masked array problem in python 2.4.4
On Wednesday 07 March 2007 14:43:45 [EMAIL PROTECTED] wrote: > Anyone knows which of my package (MA, numpy, ...) might be causing the > conflict? I could go back to the older version (on another machine), but I > really like it to work in the newer version. Any inputs would be > appreciated. Hello, could you provide us with: - the numpy version - the matplotlib version - an example of code That'd be easier for us to try and help you. Thx a lot in advance - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Plot data from custom class
On Friday 02 March 2007 14:12:24 John Hunter wrote: > I still am not able to make my mock-up custom python class work as I > would like with asarray (though it works with "list"). What am I > missing? The way I read it this appears to be in support of extension > code that wants to expose the array interface, but I have a python > object that acts like a sequence (am I missing some important method) > that wants to work properly with numpy.asarray John, Why wouldn't you use the numpy.core.ma implementation of masked arrays as a source of inspiration ? After all, what (I think) you're doing is pretty close to how masked arrays were initially implemented, as a class on its own, not derived from ndarray. Basically, that would amount to define a __array__() method that would return the numpy equivalent of your object. Or you can try to use Pyrex for your new class. That works well if you don't try to subclass ndarray. - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Bug in xaxis_date ?
Folks, I have a problem with xaxis_date in the SVN (rev2994) #-- def xaxis_date(self, tz=None): """Sets up x-axis ticks and labels that treat the x data as dates. tz is the time zone to use in labeling dates. Defaults to rc value. """ thislocator = self.xaxis.get_major_locator() if not isinstance(thislocator, DateLocator): locator = AutoDateLocator(tz) self.xaxis.set_major_locator(locator) thisformatter = self.xaxis.get_major_formatter() if not isinstance(thisformatter, DateFormatter): formatter = AutoDateFormatter(locator) self.xaxis.set_major_formatter(formatter) #-- The problem is that in the second if, locator can still be undefined if thislocator was a DateLocator. The first if could have a else clause: # self.xaxis.set_major_locator(locator) else: locator = thislocator #- Which seems to solve the problem (Of course, the same apply to yaxis_date). John, Eric, or whoever else has write access, could you take care of that ? Thanks a lot in advance P. - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier. Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] boxplot with different data length
On Monday 08 January 2007 04:34, Gerhard Spitzlsperger wrote: > Dear All, > > I am quite new to matplotlib and facing some trouble using boxplots. > > I'd like to plot two boxes (different length of data) in one plot, from > the docs > Could you point me to what I do wrong? I need especially > the different data length. Gerhard, Try to install a SVN copy of matplotlib. Eric corrected that bug not long ago. Alternatively, you can try to force your data into an array with data = N.array(data, dtype=N.object) beforehand. - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] polar axes control
On Monday 25 December 2006 01:30, Eric Firing wrote: > I don't think so--at least, I have not figured it out after a few > minutes of looking around and trying to understand how things work. I > think polar plotting needs quite a bit of work. Sorry for hijacking the thread, but a few months ago I suggested the possibility to subclass Subplot. I have a small function, 'add_generic_subplot', which just implements this possibility. Would anybody be interested ? In that case, a Polarplot would just be a particular subclass of Subplot. If there's some heavy cleaning to be done on Polar, it might be worth to consider subclassing. [I realize this was quite a useless post... Sorry again] - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Usability with matplotlib
On Monday 18 December 2006 13:29, David L Goldsmith wrote: > Simson Garfinkel wrote: > > It really depends on your audience as to whether or not 1,000,000 > > through 9,000,000 is better displayed in scientific notation or not. > > For audiences that I frequently present to, any scientific notation > > is just unacceptable. You can add quantifiers (like KBps, MBps, > > GBps), but presenting something a 5e+5 Bps will just be lost. You > > *might* get away with e+3, e+6, and e+9, but never the other e's. > > Ah, "Engineering" notation - that could be a useful helper function. A few months ago the question got asked on this very list. The idea is to define a specific formatter. Here's what I'd come with (I copy the initial post for convenience at the end of the message). If it's found useful, I could put it in the cookbook (now that I remember how to edit the wiki). Or I could leave our dear developers add it to the core. P. #-- class EngrFormatter(ScalarFormatter): """A variation of the standard ScalarFormatter, using only multiples of three in the mantissa. A fixed number of decimals can be displayed with the optional parameter `ndec` . If `ndec` is None (default), the number of decimals is defined from the current ticks. """ def __init__(self, ndec=None, useOffset=True, useMathText=False): ScalarFormatter.__init__(self, useOffset, useMathText) if ndec is None or ndec < 0: self.format = None elif ndec == 0: self.format = "%d" else: self.format = "%%1.%if" % ndec # def _set_orderOfMagnitude(self, mrange): """Sets the order of margnitude.""" locs = N.absolute(self.locs) if self.offset: oom = math.floor(math.log10(mrange)) else: if locs[0] > locs[-1]: val = locs[0] else: val = locs[-1] if val == 0: oom = 0 else: oom = math.floor(math.log10(val)) if oom <= -3: self.orderOfMagnitude = 3*(oom//3) elif oom <= -1: self.orderOfMagnitude = -3 elif oom >= 4: self.orderOfMagnitude = 3*(oom//3) else: self.orderOfMagnitude = 0 # def _set_format(self): """Sets the format string to format all ticklabels.""" # set the format string to format all the ticklabels locs = (N.array(self.locs)-self.offset) / 10**self.orderOfMagnitude + 1e-15 sigfigs = [len(str('%1.3f'% loc).split('.')[1].rstrip('0')) \ for loc in locs] sigfigs.sort() if self.format is None: self.format = '%1.' + str(sigfigs[-1]) + 'f' if self._usetex or self._useMathText: self.format = '$%s$' % self.format #.. class MinimalFormatter(Formatter): """A minimal formatter: just the plain data !""" def __init__(self,sigfigs=None): if sigfigs is None: self.fmt = "%f" else: self.fmt = "%.%if" % sigfigs def __call__(self,x,pos=None): return str(self.fmt % x).rstrip('0') - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] boxplot
On Saturday 16 December 2006 16:02, Eric Firing wrote: > It sounds like the real problem is that the initial use of asarray in > boxplot is a bug--it should transparently support an object array, as > you suggest (but numpy only), or an ordinary array, *or* a list or tuple > of data vectors, and all this should be clear in the docstring and the > example. Correct? I hope so, because I have made the change in svn. > (Well, maybe not enough changes to the example yet.) Fully agreed. There's no need for the transformation to array: the only variable which is array-related is the number of columns (viz, the number of boxes to plot). OK, there's also that: for i,pos in enumerate(positions): d = x[:,i] But it'd be as easy to enumerate the array (after a first transpose, if its a regular ndarray...) - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Filled Curves
Sergio, I think the line you see comes from plotting two shape on top one another. You may want to redefine your polygon: the easier would be something like: tt = concatenate((t,t[::-1])) vtx = concatenate((s3,s2[::-1])) fill(tt, vtx, '#e9ccce', linewidth=0) With the first command, you build a series of x coordinates from 0 to 1.01 and back to 0 (that's the t[::-1]) with second, you build the y ccordinates sequence, by taking the corresponindg point of s3, and then from s2 in reverse order. Now, your polygon is fully defined. - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Fwd: boxplot
On Saturday 16 December 2006 13:47, Simson Garfinkel wrote: > > I apologize if I offended anyone, this was really not my intention > > at all. > > Oh, I was never offended. Thanks a lot for your patience nevertheless. > I think that it's possible to get impressive results in a few hours, > but not become a pro. I see that as an advantage: you can never get bored, there's always something new to learn (I should have listened to my mom and spend less time in front of the TV as a kid). But I admit it can get a bit frustrating, when you eventually find out that there was a really simple solution to a problem, alas undocumented and buried in the code (for example, the xaxis_date thingie which doesn't do much). > I've been using matplotlib for something like > 20-40 hours right now. I've done some neat things, but have had some > problems. That's when the mailing list becomes really useful. > I've also written a neat pre-processor that allows you to embed > python and matplotlib code in LaTeX, so you don't need to have it all > spread out. And you can populate the results from SQL queries, right > there in the LaTeX. It makes paper writing much easier. Oh, that sounds great ! Could you post it somewhere ? I'm sure it'd be quite useful (I do have a need for it myself...) - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Fwd: boxplot
On Saturday 16 December 2006 13:01, David Chin wrote: > On 12/16/06, Simson Garfinkel <[EMAIL PROTECTED]> wrote: > > Thanks. I have roughly 30 years of programming experience and know > > something like 20+ languages. The learning curve here is steep, and I > > think that a lot could be done to make it less steep. > > I agree. Pierre, maybe you should google Simson's name here > before taking a condescending tone. I apologize if I offended anyone, this was really not my intention at all. My point was that after only a few hours, it is indeed possible to get impressive results and become a real MPL pro. > Anyway, I agree with the other suggestion that a lot of the stuff here > should be wikied. Now, Pierre said that one can edit the wiki, but when > I tried it ( http://scipy.org/Cookbook/Matplotlib?action=edit ), I get an > error saying "You are not allowed to edit this page." So, may I suggest > that the Wiki be opened up for editing? Information flows much more > quickly if everyone can contribute. Well, I think you have to register before being able to edit pages. There's a login button on the top right of your screen. But I agree that it's not intuitive (I have to poke around for a while to find it) (and then remember my login name). - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] wiki
> And for the work I'm doing, I have a > different number of observations and data points on different days, > so it's a pain that the current boxplot infrastructure expects all of > the boxes to be in a single array. Hence my questions. Ah OK, now I get it. Sorry for being a bit slow today. So yes, there's a problem here. The sequence is transformed into an array with 'asarray', which obviously won't work if you have different sizes of dataset. But there's a trick, tested on numpy: import numpy set1 = (rand(50)+1) * 100 set2 = (rand(25)+2) * 100 data = array([set1,set2], dtype=numpy.object_) boxplot(data,positions=[732659.,732660.]) The trick here is to force the data as objects, and not as floats. Your array is in fact an array of arrays of different sizes. That's enough to fool asarray. - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] boxplot
> I want multiple boxes on a single plot, with one box per day. Take a > look at how I've done it with just plot() and some error bars... I'm still not sure I understand where the problem is: You want several boxes in a plot ? Something along the lines of what I already sent you ? > boxplot([set1, set2],positions=[732659,732660]) Then once again, just construct of sequences of sets, a sequence of dates (as ordinals), and use something like: boxplot(setsequence, positions=datesequence). Alternatively, follow the boxplot_demo example. Then, you'll have to use the trick I sent earlier gca().set_xticklabels([num2date(x).strftime(fmt) for x in gca().get_xticklabels()]) - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] wiki
> Hi, Pierre. There's a lot of assumptions here. Indeed, and I apologize > I sort of know what numarray, Numeric and numpy are, but I don't care > all that much. I'm just interested in matplotlib for the plotting. Well, matplotlib relies on some packages to handle data arrays. It's probably a good idea to check what you have below the hood, just in case something goes wrong. It'll make things easier to help you. > The point of my email (and the questions below) is that the entire > scipy.org website is written for people who already know what's going > on. If you want to expand the user community (and simultaneously cut > down on questions) you need to make things dramatically more > understandable than they currently are. That's true, and I guess that's the reason why there's a wiki. Please feel free to add your comments and suggestions. > A related problem is the MoinMoin wiki. It is not a widely used wiki > and it has many usability problems. It is dramatically harder to use > than, say, mediawiki. But it happens to be the solution that has been chosen. - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] boxplot
> I'd love to speak python to it. But it's harder when all of the > examples are in matlab... :) Well, please have a look to pythonic_matplotlib.py in your examples folder. > > fig = figure() > > ax1 = fig.add_subplot(121) > > ax2=fig.add_subplot(122) > > Hm. I'll need to figure out why these two subplots appear on the same > axis. What do you mean ? You want two plots on a figure, or two figures? You want one plot in the topleft corner, one in hte bottom right ? You can do that as well, just tell matplotlib where to plot the axes (a bit of terminology here: an axes is a box in your figure, in which you will draw a subplot). > BTW, this whole subplot(ijk) instead of subplot(i,j,k) notation is > really, really confusing to me... Don't get overwhelmed. ijk is a shortcut for (i, j, k), that works well if you're working with less than 10 plots in either direction. I know, the learning curve is a bit steep at first, but soon you'll be a real pro. - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] wiki
> I'm very confused by the wiki in general. I click on "wiki" and it takes me > to something that doesn't obviously have anything to do with matplotlib... Well, it does say: matplotlib cookbook. > Like, what's scipy.org? Is it a company? Who is EnThought? Oh. What are you using to manipulate arrays ? numarray, Numeric, or numpy ? Assuming that you use numpy, then you must know what scipy is, right ? If not, well, br scipy.org is just a central site for numpy/scipy-related information. Enthought is a private company that works extensively with Python and numpy in particular, and that hosts the site. > Amy I allowed to contribute to the wiki? It doesn't look like it. The whole > thing is not very friendly. It's a wiki, so yes, you can contribute. No, it's not especially friendly, in the sense that nobody's here to hold your hand. > And what is this whole MoinMoin thing? "MoinMoin is a Python WikiClone, based on PikiPiki. " This converstaion is really becoming surrealistic. - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] boxplot
On Friday 15 December 2006 21:07, Simson Garfinkel wrote: > Hm. thanks for the info. But it's not perfect... I get times in my > formats, but not the dates. Here is the sample code: Yeah, I agree, the situation is far from ideal. Besides, it turns out that there's no deep magic behind have_dates, which is just a way to tell the axis to use AutoDateFormatter. Which we don't need. So: Plot your boxeds with the positions flag: > boxplot([set1, set2],positions=[732659,732660]) > ax = gca() Then use num2date: timefmt = '%b-%d-%Y' gca().set_xticklabels([num2date(x).strftime(timefmt) for x in gca().get_xticks()]) > Now, how do I get two boxplots on the same plot? Well, just draw two axes. Simson, now that you're more experienced with matplotlib, you should really start speaking python to it. fig = figure() ax1 = fig.add_subplot(121) ax2=fig.add_subplot(122) ax1.boxplot([set1, set2],positions=[732659,732660]) ax2.boxplot([set2, set1],positions=[732659,732660]) ax1.set_xticklabels([num2date(x).strftime(timefmt) for x in ax1.get_xticks()]) ax2.set_xticklabels([num2date(x).strftime(timefmt) for x in ax2.get_xticks()]) - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] boxplot
> 2. I need to have the X axis of the boxplot be dates. There doesn't > seem to be an easy way to do that. Use the "position" keyword, as a list of date ordinals (output of date2num). Then, use gca().xaxis_date(tz) where tz is your current timezone (you can use None, that's easier). Et voila. You probably gonna have to play with tick rotation and date formatting, but that's another story Using the boxplot_demo #... # multiple box plots on one figure figure() positions = [732659, 732660] boxplot(data, positions=positions) gca().xaxis_date(None) - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] question about imshow
On Tuesday 12 December 2006 06:57, John Travers wrote: > Hi, I'm struggling to get an array plotted the way I want with imshow. > I have an array A which i try to plot with > > e=(tdims[0], tdims[-1], wldims[-1], wldims[0]) > imshow(A,extent=e) > > if I set extent correctly, the image is scaled > right with respect to the y axis, but it is flipped so that the y axis > is increasing upwards. Is there a way to prevent this? MMh. You can always play with the limits on the y axis: gca().set_ylim(N.asarray(gca().get_ylim())[[-1,0]]) will invert (ymin, ymax) on the current axis (gca()) - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Contours message error
Folks, Would it be possible to switch the current error message >>> ValueError: Arguments x, y, z, mask (if present) must be 2D arrays. in cntr.c to something more explicit, when x, y, and z are 2D arrays, but one of them is complex ? Or force a downcast to float if needed ? (I know, I should have forced a conversion myself. But I just spent one hour trying to figure what was going wrong before thinking about checking the dtypes...) Thx in advance - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] pcolormesh
Talking about pcolormesh: I was just playing with it right now, and it doesn't accept the 'shading' keyword. Poking around shows that kwargs.pop('shading','flat') should be used instead of kwargs.get('shading') in axes.py (same goes for the other parameters...) - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] error bars, plot_date, and connected line
On Saturday 02 December 2006 17:39, Simson Garfinkel wrote: > Hi. I'm interested in creating a date plot showing bandwidth along a > link. I want to have a dot in the center of each date with the > average bandwidth and use the error bars to show the 25th and 75th > percentiles. I've been trying to figure out how to do this and am > having problems. My 2c: Don't bother yet about dates: first get the plot as you want it, assuming that your x data are floats (use date2num if needed). Then you can tackle the problem of displaying dates. If you poke around the sources (axes.py). you'll find that 'plot_date' is only 'plot', where a couple of extra parameters are set: if xdate: self.xaxis_date(tz) 'xdate' is a flag indicating whether the data on the x axis are dates (True) or not (False), 'tz' is the timezone flag (default to None), and 'self' is your current axes object (you can get its handle by gca() if you haven't specified it otherwise). Combining these pieces of information should to the trick (or most of it). Let us know how it goes anyway. P. - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] pylab/masked arrays issue on Intel Mac Pro
Teemu > Any ideas where the conflict might be coming from? When you type from MA import *, you overwrite the definition of 'array'. And surprisingly enough, a masked array in numpy.core.ma is an object independent of ndarray. Some functions such as swapaxes are not imported by MA (because they were not implemented for one reason or another): you then use the regular numpy function, which doesn't know how to deal with these 'masked arrays' objects. (I simplify a bit, here, but the gist is there) As you've noticed, the best solution is to use import MA That way, you leave the original numpy namespace alone, and are sure to use only "MA-approved" functions. But you'll likely gonna have to use MA.sqrt, MA.log all over your code. And may run into problems with functions that don't handle masked arrays. Still, it's the cleanest solution (the "from blah import *" tend to be frowned upon these days anyway). An alternative solution is to try the new implementation of masked arrays I've been working on: with this implementation, masked arrays are subclasses of regular arrays, which simplifies life a lot.The source file is available here: http://projects.scipy.org/scipy/numpy/wiki/MaskedArray Note the disclaimer: it's still a work in progress (even if I use it everyday and it works fine) and you'll have to modify a line in the matplotlib source to make it work OK with matplotlib, which is a bit tedious I agree. But it works. And it's actively maintained. Hope it helps P. - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] How can I avoid sharey tick ovelap?
On Friday 24 November 2006 15:14, Darren Dale wrote: > Or, you can change the formatter of your yaxis to OldScalarFormatter, which > renders the scientific notation in each tick label, rather than at the top > of the axis. Thinking about it: is there a way to grab this scientific notation ? The idea would be to get the corresponding object as a string, and update the ylabel with it. - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] How can I avoid sharey tick ovelap?
> How could I avoid this overlapping? What about deleting your first tick on ax2, with >>> ax2.set_xticks(ax2.get_xticks()[1:]) at the end of your code ? - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] axis number presentation
On Tuesday 21 November 2006 22:09, Stephen George wrote: > Thank you Pierre, > > I've taken a while to get around to it, but this code worked a treat, > and taught me a little about how I can override things in matplotlib Glad you found it useful. playing some more about it, I realized that there could be some improvement with small values between 0.001 and 1: the following modifications should take care of that: def _set_orderOfMagnitude(self, mrange): """Sets the order of margnitude.""" locs = N.absolute(self.locs) if self.offset: oom = math.floor(math.log10(mrange)) else: if locs[0] > locs[-1]: val = locs[0] else: val = locs[-1] if val == 0: oom = 0 else: oom = math.floor(math.log10(val)) if oom <= -3: self.orderOfMagnitude = 3*(oom//3) elif oom <= -1: self.orderOfMagnitude = -3 elif oom >= 4: self.orderOfMagnitude = 3*(oom//3) else: self.orderOfMagnitude = 0 - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] subplot problems using comma notation
On Thursday 16 November 2006 23:45, Josh Lifton wrote: > I've been having problems using the subplot command's comma notation Seems to work here. On a Gentoo (OK, seriously: on matplotlib 0.87.7) Josh, what version of matplotlib are you using ? - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Cross-correlation?
Ciao Sarah > cross_correlate, but given two arrays, that function returns a single > scalar value (whereas I was expecting a list of correlation > coefficients corresponding to how well the two signals match on > successive lags). That's not really a mpl question, more a 'numerix' one: what does your numerix stand for ? numpy ? numarray ? For numpy, I guess that the corresponding function is 'correlate', which you must use with the 'full' parameter: >>>corxy = N.correlate(x, y, 'full') Unless I'm mistaken, the lags are then 1-n, 2-n,..., -1, 0, 1, ..., n-1 Note that you may want to use anomalies (ie, x-x.mean() and y-y.mean()), and divide by the variances to get proper coefficients A second possibility is to use FFTs, >>>Fx = N.fft.fft(x, npad, axis=axis) >>>Fy = N.fft.fft(y, npad, axis=axis) >>>iFxy = N.fft.ifft(Fx.conj()*Fy,n=npad,axis=axis).real with npad=x.size+y.size The lags are then 0,1,2,...,n,1-n,...,-1 If you're interested, you can use these two functions that I had written #.. def ccf(x, y, axis=None): """Computes the cross-correlation function of two series `x` and `y`. Note that the computations are performed on anomalies (deviations from average). Returns the values of the cross-correlation at different lags. Lags are given as [0,1,2,...,n,n-1,n-2,...,-2,-1]. :Parameters: `x` : 1D MaskedArray Time series. `y` : 1D MaskedArray Time series. `axis` : integer *[None]* Axis along which to compute (0 for rows, 1 for cols). If `None`, the array is flattened first. """ assert(x.ndim == y.ndim, "Inconsistent shape !") #assert(x.shape == y.shape, "Inconsistent shape !") if axis is None: if x.ndim > 1: x = x.ravel() y = y.ravel() npad = x.size + y.size xanom = (x - x.mean(axis=None)) yanom = (y - y.mean(axis=None)) Fx = N.fft.fft(xanom, npad, ) Fy = N.fft.fft(yanom, npad, ) iFxy = N.fft.ifft(Fx.conj()*Fy).real varxy = N.sqrt(N.inner(xanom,xanom) * N.inner(yanom,yanom)) else: npad = x.shape[axis] + y.shape[axis] if axis == 1: if x.shape[0] != y.shape[0]: raise ValueError, "Arrays should have the same length!" xanom = (x - x.mean(axis=1)[:,None]) yanom = (y - y.mean(axis=1)[:,None]) varxy = N.sqrt((xanom*xanom).sum(1) * (yanom*yanom).sum(1)) [:,None] else: if x.shape[1] != y.shape[1]: raise ValueError, "Arrays should have the same width!" xanom = (x - x.mean(axis=0)) yanom = (y - y.mean(axis=0)) varxy = N.sqrt((xanom*xanom).sum(0) * (yanom*yanom).sum(0)) Fx = N.fft.fft(xanom, npad, axis=axis) Fy = N.fft.fft(yanom, npad, axis=axis) iFxy = N.fft.ifft(Fx.conj()*Fy,n=npad,axis=axis).real # return iFxy/varxy #.. def ccf1d(x,y): """Computes the crosscorrelation of two flat arrays `x` and `y`, with the numpy.correlate function. Note that the computations are performed on anomalies (deviations from average). """ if x.ndim > 1: x = x.ravel() if y.ndim > 1: y = y.ravel() (xanom, yanom) = (x-x.mean(), y-y.mean()) corxy = N.correlate(xanom, yanom, 'full') n = min(x.size, y.size) #return N.r_[ xc[len(yf)-1:], 0, xc[:len(yf)-1] ] corxy = N.r_[ corxy[:n][::-1], 0, corxy[n:][::-1] ] varxy = N.sqrt(N.inner(xanom,xanom) * N.inner(yanom,yanom)) return corxy/varxy > > So ... does matplotlib have something akin to what I'm after or is > there an extention that might have it? > > Very many thanks, > > Sarah > > (*) > > http://www.mathworks.com/access/helpdesk/help/toolbox/garch/index.html?/acc >ess/helpdesk/help/toolbox/garch/crosscorr.html > http://www.mathworks.com/access/helpdesk/help/toolbox/signal/index.html?/ac >cess/helpdesk/help/toolbox/signal/xcorr.html - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Removing a data series
> My basic question: Is it possible to remove a data series from a matplotlib > plot? A quite similar question was asked yesterday: The lines are stored in "ax.lines", by chronological order. If you want to delete the second one, just use del(ax.lines[1]), and redraw if needed. - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Removing a line from a plot
> I have a GUI written in wxPython, the main portion of it is a > matplotlib canvas. There is a tree control on the left with > checkboxes: if the user checks a checkbox, I add a line on the plot. > So far so good. The problem comes when the user *un-checks* the > checkbox. I would like to remove the line from the plot, but the only > way I found to do it is to do: To suppress the last line drawn: del(gca().lines[-1]) (replace gca() by the handle of the subplot you're acting on) - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] hist normalise error?
>>> hist? ... Docstring: HIST(x, bins=10, normed=0, bottom=0, align='edge', orientation='vertical', width=None, **kwargs) Compute the histogram of x. bins is either an integer number of bins or a sequence giving the bins. x are the data to be binned. The return values is (n, bins, patches) If normed is true, the first element of the return tuple will be the counts normalized to form a probability density, ie, n/(len(x)*dbin) align = 'edge' | 'center'. Interprets bins either as edge or center values orientation = 'horizontal' | 'vertical'. If horizontal, barh will be used and the "bottom" kwarg will be the left edges. width: the width of the bars. If None, automatically compute the width. kwargs are used to update the properties of the hist bars In your example, len(x)=52, and dbins=bin[1]-bin[0]=4.46667, which gives: n.sum() * dbins = 1 - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] "Vague" lines
On Tuesday 07 November 2006 04:49, Bart van Kuik wrote: > I have created plots, but I find the line style is a bit "vague". The > line isn't one sharp, contrasting color, but smoothly blended to the > background. Is the correct term anti aliasing? Seems like it. Make sure the 'antialiased' property of your lines/dots is set to False by modifying your matplotlibrc default file (if you want this behaviour to become the default), or by using rcParams['lines.antialiased']=False, or rc('lines.antialiased',False)... - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] axis number presentation
> One thing I cannot work out is the axis number presentation. > Cannot find any documentation about how to control the presentation of > the axis number. Poke around ticker.formatter > However I would prefer it would present in enginering notation (10, 100, > 1e3, 10e3, 100e3, 1e6, 10e6 ...etc) The easiest is to define your own formatter. Please try the solution below. You can use it as: gca().xaxis.set_major_formatter(EngrFormatter(3)) # - # --- Formatters --- # - class EngrFormatter(ScalarFormatter): """A variation of the standard ScalarFormatter, using only multiples of three in the mantissa. A fixed number of decimals can be displayed with the optional parameter `ndec` . If `ndec` is None (default), the number of decimals is defined from the current ticks. """ def __init__(self, ndec=None, useOffset=True, useMathText=False): ScalarFormatter.__init__(self, useOffset, useMathText) if ndec is None or ndec < 0: self.format = None elif ndec == 0: self.format = "%d" else: self.format = "%%1.%if" % ndec # def _set_orderOfMagnitude(self, mrange): """Sets the order of margnitude.""" ScalarFormatter._set_orderOfMagnitude(self, mrange) self.orderOfMagnitude = 3*(self.orderOfMagnitude//3) # def _set_format(self): """Sets the format string to format all ticklabels.""" # set the format string to format all the ticklabels locs = (N.array(self.locs)-self.offset) / 10**self.orderOfMagnitude+1e-15 sigfigs = [len(str('%1.3f'% loc).split('.')[1].rstrip('0')) \ for loc in locs] sigfigs.sort() if self.format is None: self.format = '%1.' + str(sigfigs[-1]) + 'f' if self._usetex or self._useMathText: self.format = '$%s$'%self.format - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Subclassing Figure and pylab.figure()
On Tuesday 20 June 2006 11:37, John Hunter wrote: > >>>>> "Pierre" == Pierre GM <[EMAIL PROTECTED]> writes: > > Pierre> Folks, > Pierre> I have a tailor-made subclass of Figure (say, MyFigure) that I'd > Pierre> like to use interactively. Ideally, I'd like to have > Pierre> pylab.figure() (or an equivalent) create a MyFigure instance, > Pierre> instead of Figure. > Pierre> > Pierre> I wrote a myfigure() function based on pylab.figure(), > Pierre> substituting the > Pierre> - > Pierre> figManager = new_figure_manager(num, **figargs) > Pierre> - > Pierre> by > Pierre> - > Pierre> thisFig = MyFigure(*args, **kwargs) > Pierre> canvas = FigureCanvasGTKAgg(thisFig) > Pierre> figManager = FigureManagerGTKAgg(canvas, num) > Pierre> > Pierre> > Pierre> That seems to give me what I want, as long as I use the > Pierre> GTKAgg backend. What should I do to have the same result > Pierre> with another backend, without having to rewrite a > Pierre> new_figure_manager each time ? Anyway, is it even the way > Pierre> to go ? > > Note that pylab basically has the same problem, as each backend > defines their own new_figure_manager function. The problem is not the > Figure, but the FigureCanvas, which is backend dependent. Take a look > at the "switch_backend" function in pylab > > def switch_backend(newbackend): > """ > Calling this command will close all open windows. > """ > close('all') > global new_figure_manager, draw_if_interactive, show > matplotlib.use(newbackend) > reload(backends) > from backends import new_figure_manager, draw_if_interactive, show > > You could emulate this approach John, Thx for your answer. IMHO, the problem lies really with Figure, not Canvas. I'd need the Canvas, whatever backend defines it, recognizes that the figure is not a classical 'Figure' , but a subclass of it, with its own special properties/methods. I gonna think aloud for a minute One way would be to add a 'subclass' option to every new_figure_manager, so that the `thisFig = Figure(**figargs)` would be replaced by `thisFig = subclass(**figargs)` (with subclass set to Figure by default). A bit overkill, eh ? In fact, as long as my special properties/methods can be accessed Figure instance, I should be OK. What would be the better way to have the properties/methods of a child recognized by its parent (revered inheritance ?) ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Subclassing Figure and pylab.figure()
Folks, I have a tailor-made subclass of Figure (say, MyFigure) that I'd like to use interactively. Ideally, I'd like to have pylab.figure() (or an equivalent) create a MyFigure instance, instead of Figure. I wrote a myfigure() function based on pylab.figure(), substituting the - figManager = new_figure_manager(num, **figargs) - by - thisFig = MyFigure(*args, **kwargs) canvas = FigureCanvasGTKAgg(thisFig) figManager = FigureManagerGTKAgg(canvas, num) That seems to give me what I want, as long as I use the GTKAgg backend. What should I do to have the same result with another backend, without having to rewrite a new_figure_manager each time ? Anyway, is it even the way to go ? Thanks for any ideas P. ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users