Re: [Matplotlib-users] Looping through all the built-in colormaps
On Wednesday 24 February 2010 00:45:56 David Goldsmith wrote: Hi! I'm trying to loop through all the built-in colormaps, applying each to an image before printing it to a file, then moving on to the next one. from matplotlib import cm for cmap in dir(cm): # cmap in cm doesn't work 'cause cm is a module ax.imshow(image, cmap) canvas.print_figure('image_'+cmap) works until cmap == 'LUTSIZE', which evaluates to an integer and thus raises an exception. I tried putting it in a try/except: for cmap in dir(cm): try: ax.imshow(image, cmap) canvas.print_figure('image_'+cmap) except: pass but despite this, after 'LUTSIZE', every cmap - even valid ones - also raises the exception, and thus doesn't get used. So I tried just by-passing cmap == 'LUTSIZE' (in the obvious way), but then encountered cmap == 'ScalarMapable', which resulted in the same subsequent behavior as 'LUTSIZE'. At that point I decided I should try a positive filter, so I figured out that cmaps are instances of matplotlib.colors.LinearSegmentedColormap (which I imported as LSC) and tried adding an if isinstance(cmap, LSC), but of course that didn't work, 'cause the elements of dir(cm) are strings, not LSC's. At this point I've decided I've wasted too much time trying to figure this out on my own, so: 0) is there some elegant way to do what I want to do? 1) why doesn't this: for cmap in dir(cm): try: ax.imshow(image, cmap) canvas.print_figure('image_'+cmap) except: pass work (i.e., simply bypass those elements of dir(cm) which cause imshow to raise an exception, but then continue on as if nothing had happened)? Is this a bug? Thanks! DG Hi, some time ago somebody proposed an example on the list to circle through all possible colormaps. In this time cm had an attribute cm.cmapnames, which hold all these names, but nowerdays (svn-HEAD) this attribute has be removed and in my opinion 'cm.cmap_d.keys()' is an appropriate replacement for this. In your example, you cycle through all tools/functions/variables of the cm-module and therefore encounter non-cmaps (like LUTSIZE, ...). To make my point: I think you have to replace for cmap in dir(cm): with for i in cm.cmap_d.keys(): Kind regards, Matthias -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Looping through all the built-in colormaps
On Wed, Feb 24, 2010 at 3:06 AM, Matthias Michler matthiasmich...@gmx.net wrote: some time ago somebody proposed an example on the list to circle through all possible colormaps. In this time cm had an attribute cm.cmapnames, which hold all these names, but nowerdays (svn-HEAD) this attribute has be removed and in my opinion 'cm.cmap_d.keys()' is an appropriate replacement for this. The names are available as cm._cmapnames. However, this list does not include any reverse map names (i.e., names like jet_r). So, yes, you should use cmap_d instead. Regards, -JJ -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Looping through all the built-in colormaps
On Tue, Feb 23, 2010 at 6:45 PM, David Goldsmith d_l_goldsm...@yahoo.com wrote: 1) why doesn't this: for cmap in dir(cm): try: ax.imshow(image, cmap) canvas.print_figure('image_'+cmap) except: pass work (i.e., simply bypass those elements of dir(cm) which cause imshow to raise an exception, but then continue on as if nothing had happened)? Is this a bug? I believe this happens because you never clear your figure (or axes) between print_figure. imshow does not erase an existing image and you end up with bunch of images overlapped. And the exceptions are keep being raised as the image you created with cmap=LUTSIZE is still there. calling ax.cla() before ax.imshow works for me. Regards, -JJ -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Looping through all the built-in colormaps
On Wed, Feb 24, 2010 at 3:56 AM, David Goldsmith d_l_goldsm...@yahoo.com wrote: cmap='LUTSIZE' does not create an image: it is an invalid value for imshow's cmap argument. Many images are created successfully by my loop before cmap='LUTSIZE' without me calling cla, and Friedrich's soln. works great w/out me having to call cla. It DOES create an image at least in the svn version of matplotlib (although I consider it as a bug). But this may not be true in other version. As I said, without calling cla, you end up with bunch of overlapping images (unless hold is False). It DOES NOT mean that the results will be wrong. It only means that it will increase the drawing time and/or output size. You do not have to call cla if you don't care about these. You may check the number of images in the current figure by print len(ax.images) -JJ -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Looping through all the built-in colormaps
The following was sent unintentionally in private e-mail (my e-mail program always selects the sender as recipient first :-( ). I think the solution by Jae-Joon is also elegant, but nevertheless the following may be useful also (and maybe also in other places): -- Forwarded message -- From: Friedrich Romstedt friedrichromst...@gmail.com Date: 2010/2/24 Subject: Re: [Matplotlib-users] Looping through all the built-in colormaps To: David Goldsmith d_l_goldsm...@yahoo.com 0) is there some elegant way to do what I want to do? Don't know whether it's elegant or not, but it should do the job: for cmap_name in dir(cm): cmap_object = getattr(cm, cmap_name) if isinstance(cmap_object, matplotlib.colors.LinearSegmentedColormap): [...] 1) why doesn't this: for cmap in dir(cm): try: ax.imshow(image, cmap) canvas.print_figure('image_'+cmap) except: pass work (i.e., simply bypass those elements of dir(cm) which cause imshow to raise an exception, but then continue on as if nothing had happened)? Is this a bug? I guess it's because you have messed up with the internals of the axes, when passing an invalid entry. It gets stored somewhere without check, and then causes subsequent error occuring before the next element is applied fully, I guess. It's more a bug of your code than of matplotlib, because your argument did not fulfil specification :-) Friedrich -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Issue with sample from website and rc()
Hi, I've tried to set the size of the main font by doing: import matplotlib.pyplot as pyplot font = {'size' : 'larger'} pyplot.rc('font', **font) as indicated in http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.rc It failed with: raise ValueError('Could not convert %s to float' % s) ValueError: Could not convert larger to float I'm using Matplotlib 0.99.1.2. Matthieu -- Information System Engineer, Ph.D. Blog: http://matt.eifelle.com LinkedIn: http://www.linkedin.com/in/matthieubrucher -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Issue with sample from website and rc()
Indeed, with a fixed value, I could bypass this, but the main issue is that the documentation says that it should work (xx-small, x-small, small, medium, large, ... although I don't know if it should be larger, as indicated in rc() doc, or large as indicated in the font size doc IIRC). Matthieu 2010/2/24 Philipp Bender li...@rootiniert.de: The error is the 'size':'larger', not the passing as keyword arguments. Maybe you try to stick (as workaround) with a fixed number, like 'size':12 It's located in matplotlib/lib/matplotlib/rcsetup.py def validate_float(s): 'convert s to float or raise' try: return float(s) except ValueError: raise ValueError('Could not convert %s to float' % s) - conversion of 'larger' to float fails, I don't know, maybe this should go through validate_fontsize instead of validate_float? Or, if failed in validate_floats, to validate_fontsize? Like def validate_float(s): 'convert s to float or raise' try: return float(s) or validate_fontsize() except ValueError: raise ValueError('Could not convert %s to float' % s) Regards, Philipp -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Information System Engineer, Ph.D. Blog: http://matt.eifelle.com LinkedIn: http://www.linkedin.com/in/matthieubrucher -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] reset graphic
Hi all Days ago I ask for tips about to improvemente my code on http://dpaste.com/161149/ Today, it's work ok on my web app. I fill it a form and when press submit I generate the graphic. But, I fill it the form again and press submit again, it will generate a second graphic instead of reset the previous and created a new one. so... What I need to restart my plot for not print new graphics with the previous one or on them? well. thanks in advanced all Samuel -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] configuring colorbar labels on a black background
Jae-Joon Lee wrote: This seems to be a bug and I recommend you to file a bug. This happens because Axis.set_ticklabels method only changes the attributes of left (or bottom) tick labels. Meanwhile, try for t in colorbar.ax.get_yticklabels(): t.set_color(w) -JJ Thanks for the explanation and alternative which works just fine! As per your suggestion, I have submitted a trouble report (2957923). entitled: set_yticklabels(labels, color='white') ignored -- jv On Tue, Feb 23, 2010 at 11:03 AM, Jim Vickroy jim.vick...@noaa.gov wrote: Hello, I'm (unsuccessfully) trying to generate a figure (with a labeled colorbar) having a black background. Here is the code. _purpose_ = 'demonstrate capability to create PNG with black background including labeled color bar' _author_ = 'jim.vick...@noaa.gov' import numpy # http://numpy.scipy.org/ import matplotlib # http://matplotlib.sourceforge.net/index.html matplotlib.use('Agg') # http://matplotlib.sourceforge.net/backends.html -- probably the fastest, non-GUI, rendering backend import matplotlib.pyplot as plot # http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot import matplotlib.cm # color maps import sys assert sys.version== '2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)]', sys.version assert numpy.__version__ == '1.4.0', numpy.__version__ assert matplotlib.__version__ == '0.99.1', matplotlib.__version__ data_min = 0 data_max = 256 data = numpy.random.randint(data_max, size=(512,512)) rows_cnt, columns_cnt = data.shape shape= rows_cnt, columns_cnt x= numpy.empty(data.shape, dtype=int) y= numpy.empty(data.shape, dtype=int) x[:] = numpy.arange(rows_cnt) y[:] = numpy.arange(columns_cnt) XI, YI = numpy.meshgrid(x[0], y[0]) title = 'this is the figure title' plot.clf() # clear the figure plot.title(title,color='white',backgroundcolor='black') plot.axis('off') colormap = 'gist_heat' config = dict(cmap=eval('matplotlib.cm.%s' % colormap), vmin=data_min, vmax=data_max) # vmin,vmax specify a fixed (color-map) scale plot.pcolormesh(XI, YI, data, **config) colorbar = plot.colorbar() ## # labels = ??? list of strings labels ??? labels = [str(i) for i in range(10)] colorbar.ax.set_yticklabels(labels, color='white') ## plot.imshow(data, interpolation='bilinear', cmap=config['cmap'], origin='upper', extent=[0,rows_cnt,0,columns_cnt]) # plot.show() # interactive filename = 'trial-plot-with-labeled-colorbar.png' plot.savefig(filename, facecolor='black') plot.close() which generates a figure with a black background and invisible (black) color bar labels. I'm probably going about this completely wrong. Questions: How do I get white color bar labels? How do I access the generated sequence of string labels (for use as the first set_yticklabels parameter) rather than artificially defining a list of labels? Thanks, -- jv -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] can't picker once pan or zoom chosen
marc desmarais-2 wrote: I created a simple scatter plot and a service routine to print out the coordinates of the points I pick with the cursor (based on the demo). It works until I select the pan or zoom cursor. After I zoom or pan, I can no longer get back to the normal cursor which allows me to pick a circle. Even clicking home doesn't help. The code is shown below from matplotlib import figure,pyplot from numpy import linspace,sin,take fig=pyplot.figure() ax1=fig.add_subplot(1,1,1) # (numRows, numCols, plotNum) t=linspace(0,10,100) y1=sin(5*t) y2=y1+sin(10*t) line1=ax1.scatter(y1,y2,picker=True) def onpick1(event): ind = event.ind print 'onpick1 scatter:', ind, take(y1, ind), take(y2, ind) fig.canvas.mpl_connect('pick_event', onpick1) pyplot.show() I ran into the same problem today. Does someone know of a workaround? I use a recent version of matplotlib and the default tk backend. It seems like the tool bar overrides any user defined events. Is there a way to deactivate the zoom and pan cursors? - Kjell Magne Fauske -- View this message in context: http://old.nabble.com/can%27t-picker-once-pan-or-zoom-chosen-tp25097973p27714178.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] can't picker once pan or zoom chosen
Kjell Magne Fauske wrote: I ran into the same problem today. Does someone know of a workaround? I use a recent version of matplotlib and the default tk backend. It seems like the tool bar overrides any user defined events. Is there a way to deactivate the zoom and pan cursors? - Kjell Magne Fauske I'm sorry for the noise. To disable the zoom and pan cursors you just have to click the zoom or pan button again. Picking will then start working again. - Kjell Magne -- View this message in context: http://old.nabble.com/can%27t-picker-once-pan-or-zoom-chosen-tp25097973p27714182.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] reset graphic
I found a solutiont. sharing with everyone... http://stackoverflow.com/questions/1874642/how-to-use-matplotlib-in-django see ya 2010/2/24 Samuel Teixeira Santos arcano...@gmail.com Hi all Days ago I ask for tips about to improvemente my code on http://dpaste.com/161149/ Today, it's work ok on my web app. I fill it a form and when press submit I generate the graphic. But, I fill it the form again and press submit again, it will generate a second graphic instead of reset the previous and created a new one. so... What I need to restart my plot for not print new graphics with the previous one or on them? well. thanks in advanced all Samuel -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Embedding matplotlib in Tkinter Applications
On Wed, Feb 24, 2010 at 7:14 AM, Alan G Isaac alan.is...@gmail.com wrote: On 2/24/2010 2:36 AM, Friedrich Romstedt wrote: Can you explain to me why you are so restrictive about GPLed code? I mean, it's all OSS? The licenses are very different: BSD (and MIT) do not impose a viral copyleft. This is why Python is not GPL, nor is NumPy or Matplotlib. People writing code under BSD-like licenses must carefully avoid viral infection from GPL'd code. Second, while John Hunter's views are not identical to mine Nor mine wink. I would say several things differently today -- here is the version I wrote for the mpl docs: http://matplotlib.sourceforge.net/devel/coding_guide.html#why-bsd-compatible JDH -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Embedding matplotlib in Tkinter Applications
http://neuroimaging.scipy.org/site/doc/manual/html/faq/johns_bsd_pitch.html: Many people choose the GPL when releasing a package because it is the most famous open source license, and did not consider issues such as those raised here when choosing a license. Alan, Thank you for your comment. I think I will release diagram_cl as my first MIT project :-) Hope that it finds some users then. Also, I consider switching to MIT license completely. In fact, I like it much more, it's shorter, more concise, and you can use my software ... I'm not shure whether someone can release software under GPL incorporating MIT licensed software? Otherwise I would release under dual license. Friedrich 2010/2/24 Alan G Isaac alan.is...@gmail.com: On 2/24/2010 2:36 AM, Friedrich Romstedt wrote: Can you explain to me why you are so restrictive about GPLed code? I mean, it's all OSS? The licenses are very different: BSD (and MIT) do not impose a viral copyleft. This is why Python is not GPL, nor is NumPy or Matplotlib. People writing code under BSD-like licenses must carefully avoid viral infection from GPL'd code. Second, while John Hunter's views are not identical to mine, he makes a collection of important points about licensing here: http://neuroimaging.scipy.org/site/doc/manual/html/faq/johns_bsd_pitch.html I'm going to treat John's note as enough of an answer to your question unless you want more discussion. Naturally, since you wrote the code, you get to choose the license, and your choice is obviously none of my business. Hopefully that goes without saying, but I'll say it to avoid misunderstanding. Did you notice that it is not an example but an independent standalone package? I'm not shure about this because you always talk about example. But maybe the summary is way too long, though ... Since you posted this on Matplotlib, I assumed you wanted people to be able to look at how you did it, not just use it. I am not diminishing the application by saying it looks to be a nice example of how to embded Matplotlib in Tk. If it were BSD-licensed I would probably get around to looking at your code. Alan Isaac -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Embedding matplotlib in Tkinter Applications
On Wed, Feb 24, 2010 at 8:17 AM, Friedrich Romstedt friedrichromst...@gmail.com wrote: I'm not shure whether someone can release software under GPL incorporating MIT licensed software? Otherwise I would release under dual license. Yes, GPL projects can use MIT or BSD code, but not vice-versa. -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Using IDLE - program still running when graph window is closed
How does one ensure that once a graph has been produced by Matplotlib and that graph has been closed by the user that the program itself stops? What I am currently getting is that when I close the graph pop-up window and then close IDLE, I get a message that the program is still running and am I sure that I want to stop it. Yes, I am sure, but I don't want to have to keep killing the IDLE interpreter window in order to do so, but if I don't, then I am seemingly unable to produce another graph pop-up window. How do I control this from within the script itself? I am using Debian testing with Python 2.5.5 TIA AG -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] boxplot bug
Probably this change would upset John Tukey if he were alive. I still wonder how you ignore the data since boxplot is there to represent the data :) Tell me how to undiff the changes then I will test your idea. On Wed, Feb 24, 2010 at 12:03 AM, Ariel Rokem aro...@berkeley.edu wrote: No - not the 'widths' kwarg. I want something that *looks* like the boxplot, but for which I will have control of setting the ranges delimited by the box and delimited by the whiskers (in the vertical dimension, not the horizontal dimension). I resorted to hacking something from the existing code (see attached diff). This simply allows you to over-ride the computation of box_y, med_y and the wisk_lo and wisk_hi, which are otherwise derived from the data. In other words, it allows you to ignore the data :-) Cheers - Ariel On Tue, Feb 23, 2010 at 3:15 PM, Gökhan Sever gokhanse...@gmail.comwrote: On Tue, Feb 23, 2010 at 5:04 PM, Ariel Rokem aro...@berkeley.edu wrote: Hi - yes - but I want something that looks like the generic boxplot, but in which I can control where the edges of the boxes are placed what the sizes of the whiskers are. A combination of errorbar and bar, with this appearance, if you will. Cheers - Ariel I guess then yours will be a non-standard box-plot because in a regular boxplot median is at 50th percentile, and the edges are at 25 and 75th respectively. There is no consensus for whiskers some uses 5 and 95 some 10 - 90 or you could come up with your own pair. Don't get surprised if you see different results for different percentiles. See at http://old.nabble.com/incorrect-boxplot--td25440025.html Probably you don't seek something like boxplot's widths kw arg if I understand you right? On Tue, Feb 23, 2010 at 2:49 PM, Gökhan Sever gokhanse...@gmail.comwrote: On Tue, Feb 23, 2010 at 3:02 PM, Ariel Rokem aro...@berkeley.eduwrote: Hi - more generally, is there any way to control the location of the median line, the vertical size of the box and the vertical location of the whiskers? Thanks - Ariel Aren't those generically calculated from the data? -- Gökhan -- Ariel Rokem Helen Wills Neuroscience Institute University of California, Berkeley http://argentum.ucbso.berkeley.edu/ariel -- Gökhan -- Ariel Rokem Helen Wills Neuroscience Institute University of California, Berkeley http://argentum.ucbso.berkeley.edu/ariel -- Gökhan -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Using IDLE - program still running when graph window is closed
On Wed, Feb 24, 2010 at 11:51 AM, AG computing.acco...@googlemail.com wrote: How does one ensure that once a graph has been produced by Matplotlib and that graph has been closed by the user that the program itself stops? What I am currently getting is that when I close the graph pop-up window and then close IDLE, I get a message that the program is still running and am I sure that I want to stop it. Yes, I am sure, but I don't want to have to keep killing the IDLE interpreter window in order to do so, but if I don't, then I am seemingly unable to produce another graph pop-up window. How do I control this from within the script itself? I am using Debian testing with Python 2.5.5 IDLE just doesn't work well with matplotlib (or GUI apps), as has been recently discussed here (if you Google for matplotlib and IDLE you'll find lots of posts about it). You could use ipython instead, and now there is also DreamPie (http://dreampie.sourceforge.net/), a new IDE which claims to play well with matplotlib. Those who embed their matplotlib plots in a GUI app also don't face this concern. Che -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] table on right and rotating the table entries
I looked at the examples online and have searched the newsgroup and am stuck. I figured out how to place the table on the right hand side but now I would like to have the table display as follows: colors for headding date clear Left in blueright in red date Left Right 1.1.2001 4 5.5 1.1.2003 03 3.5 etc. The attached code should be fully runable so you can see what it is doing and what I am trying to do Thank you duckman #!/usr/bin/python import matplotlib import numpy as np import matplotlib.pyplot as plt import matplotlib.mlab as mlab import matplotlib.ticker as ticker from pylab import * from matplotlib.colors import colorConverter axes([0.03, 0.2, 0.9, 0.7]) data = [[4,03,11,11.1,12.5,12.9,11.1,11,11.3,21,13.4,12,21,21,11,15.55,12,22,22,11.1,14,17,13,12,13,10,16.0,14.5,12,12,12,12,12,12,13,13,14,14,13,13,14,14,14,14,12,12,13], [5.5,03.5,11.11,11.2,13.9,19.3,11.1,41,12.3,22.0,12.8,13,30,21.5,31,17.05,15,23,33,11.2,15,18,13,13,11,18.2,21,19.5,16,16,13,13,13,13,14,14,14,14,14,14,14,14,15,15,12,12,14]] title('Hop History for John doe \n 02.20.2010') locs, colLabels = xticks([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46], ['01.01.2001', '01.01.2003', '08.01.2004', '03.03.2007', '06.08.2007', '06.12.2007', '01.01.2008', '02.25.2008', '04.04.2008', '05.27.2008', '05.27.2008', '05.27.2008', '05.27.2008', '05.27.2008', '05.30.2008', '06.01.2008', '06.11.2008', '06.11.2008', '06.19.2008', '06.19.2008', '06.19.2008', '07.10.2008', '07.10.2008', '07.10.2008', '07.10.2008', '07.18.2008', '07.22.2008', '07.22.2008', '01.27.2009', '01.27.2009', '02.24.2009', '02.24.2009', '02.24.2009', '02.24.2009', '05.19.2009', '05.19.2009', '05.19.2009', '05.19.2009', '06.05.2009', '06.05.2009', '06.05.2009', '06.05.2009', '06.29.2009', '06.29.2009', '08.28.2009', '08.28.2009', '11.23.2009']) rowLabels = ('Right', 'Left') linecolor = ('#3300ff','#ff') vals = arange(1, 43, 2) rows = len(data) ind = arange(len(colLabels)) cellText = [] #for row in xrange(rows): #coff = colLabels[row] #cellText.append(['%1.2f' % (x) for x in coff]) for row in xrange(rows): plot(arange(0,47), data[row], '.-', color=linecolor[row]) yoff = data[row] cellText.append(['%1.0f' % (x) for x in yoff]) yticks(vals, ['%d' % val for val in vals]) setp(colLabels, 'rotation', '90') legend(('Right','Left')) the_table = table(cellText=cellText, cellLoc='right', rowLabels=rowLabels, rowColours=linecolor, rowLoc='left', colLabels=colLabels, colLoc='right', loc='right') savefig(/var/www/html/mfx/419/graph.png,dpi=(1024/4)) -- View this message in context: http://old.nabble.com/table-on-right-and-rotating-the-table-entries-tp27714264p27714264.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Using IDLE - program still running when graph window is closed
C M wrote: On Wed, Feb 24, 2010 at 11:51 AM, AG computing.acco...@googlemail.com wrote: How does one ensure that once a graph has been produced by Matplotlib and that graph has been closed by the user that the program itself stops? What I am currently getting is that when I close the graph pop-up window and then close IDLE, I get a message that the program is still running and am I sure that I want to stop it. Yes, I am sure, but I don't want to have to keep killing the IDLE interpreter window in order to do so, but if I don't, then I am seemingly unable to produce another graph pop-up window. How do I control this from within the script itself? I am using Debian testing with Python 2.5.5 IDLE just doesn't work well with matplotlib (or GUI apps), as has been recently discussed here (if you Google for matplotlib and IDLE you'll find lots of posts about it). You could use ipython instead, and now there is also DreamPie (http://dreampie.sourceforge.net/), a new IDE which claims to play well with matplotlib. Those who embed their matplotlib plots in a GUI app also don't face this concern. Che Thanks Che. Have downloaded/ installed dreampie and am giving it a whirl. Haven't figured out how to load pre-written scripts and the docs are pretty near non-existent, but with enough experimentation I'm sure I'll get there. Cheers AG -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Setting graph to commence at 1 on x-axis
Hi How do I set up my matplotlib.pyplot code so that the data for the x-axis is plotted beginning at 1 not the default 0. To illustrate: I have a set of time trials and error probability calculations. Trials are x and scores are y. At present, the first trial is plotted on the graph at 0 which is illogical. I admit that I'm not sure exactly what I am looking for, but I can't see this mentioned in the docs. I just want the plot to begin at trial 1, not the 0; however, I don't mind if the x-axis has a 0 scale on it, but trials don't begin at a 0 trial, so how do I get around this. I've listed the basic code below: plt.plot( scores ) plt.ylabel( Scores ) plt.xlabel( Trials ) plt.show() TIA AG -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Setting graph to commence at 1 on x-axis
On 24 February 2010 13:36, AG computing.acco...@googlemail.com wrote: Hi How do I set up my matplotlib.pyplot code so that the data for the x-axis is plotted beginning at 1 not the default 0. To illustrate: I have a set of time trials and error probability calculations. Trials are x and scores are y. At present, the first trial is plotted on the graph at 0 which is illogical. I admit that I'm not sure exactly what I am looking for, but I can't see this mentioned in the docs. I just want the plot to begin at trial 1, not the 0; however, I don't mind if the x-axis has a 0 scale on it, but trials don't begin at a 0 trial, so how do I get around this. I've listed the basic code below: plt.plot( scores ) plt.ylabel( Scores ) plt.xlabel( Trials ) plt.show() You can explicitly specify x-axis values: x = np.arange(len(scores)) + 1 plt.plot(x, scores) HTH, Angus. -- AJC McMorland Post-doctoral research fellow Neurobiology, University of Pittsburgh -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] [SOLVED] Re: Setting graph to commence at 1 on x-axis
Angus McMorland wrote: On 24 February 2010 13:36, AG computing.acco...@googlemail.com wrote: Hi How do I set up my matplotlib.pyplot code so that the data for the x-axis is plotted beginning at 1 not the default 0. To illustrate: I have a set of time trials and error probability calculations. Trials are x and scores are y. At present, the first trial is plotted on the graph at 0 which is illogical. I admit that I'm not sure exactly what I am looking for, but I can't see this mentioned in the docs. I just want the plot to begin at trial 1, not the 0; however, I don't mind if the x-axis has a 0 scale on it, but trials don't begin at a 0 trial, so how do I get around this. I've listed the basic code below: plt.plot( scores ) plt.ylabel( Scores ) plt.xlabel( Trials ) plt.show() You can explicitly specify x-axis values: x = np.arange(len(scores)) + 1 plt.plot(x, scores) HTH, Angus. Hi Angus Thanks for the quick reply. Once I imported numpy as np and re-ran the program that did the trick perfectly. Many thanks!! All the best AG -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] dropdown menu
Hello, I'm also interested in getting this done and started playing with the classes in offsetbox.py. I'll post if I get something working. The only way I can think of achieving the 'dropdown' effect is by changing the 'visible' property on the children. Is this the way to do it? Any better suggestions? Thanks, Nadia John Hunter wrote: On Mon, Feb 22, 2010 at 4:26 AM, Wolfgang Kerzendorf wkerz...@mso.anu.edu.au wrote: Hello, Now that I have found the awesome widgets in matplotlib I want more: dropdown menus? will that come at some stage? I have worked on it, but not finished it. I put the code in svn under examples http://matplotlib.sourceforge.net/examples/widgets/menu.html but it would be migrated to matplotlib.widgets once it is completed. If you or someone else wants to run with it, that would be great. It would be handy to have this functionality. I wrote this before JJ provided his nice containers in offsetbox, and it should probably be reworked to use the OffsetbOX JDH -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] How to increase axis and tick linesize?
Dear matplotlib users, I have a problem with my plots, it is that the plot axes and the tick marks are too small, is there a way to increase the 'lineweight' and size of these basic features? I am not asking about axis label text size and that of the information inside the plot, but rather the basic skeleton of the plot. I suppose I can make thicker ticks by hand w/ the xvline and xhline modules, but I'd rather not do it this way. Also I often find that the xlabel is too close to the plot box (xaxis) is there a way to increase this distance besides making my own labels via text. Thanks, Matthew -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] How do I turn all ticks off?
Hi! Sorry for the really elementary Q's but I'm not having much luck searching the User Guide: How do I turn all ticks off (i.e., the labels and the tick mark lines, on both axes)? Thanks! DG -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] How do I turn all ticks off?
On Wed, Feb 24, 2010 at 8:48 PM, David Goldsmith d_l_goldsm...@yahoo.comwrote: Hi! Sorry for the really elementary Q's but I'm not having much luck searching the User Guide: How do I turn all ticks off (i.e., the labels and the tick mark lines, on both axes)? Thanks! DG Too dry but it is what you want: I[77]: plt.plot(range(10)) O[77]: [matplotlib.lines.Line2D object at 0xe976a6c] I[78]: ax = plt.gca() I[85]: ax.xaxis.set_major_locator(pylab.NullLocator()) I[86]: ax.yaxis.set_major_locator(pylab.NullLocator()) -- Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Gökhan -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] How to increase axis and tick linesize?
On Wed, Feb 24, 2010 at 5:45 PM, Matthew MacLeod macl...@eefus.colorado.edu wrote: Dear matplotlib users, I have a problem with my plots, it is that the plot axes and the tick marks are too small, is there a way to increase the 'lineweight' and size of these basic features? I am not asking about axis label text size and that of the information inside the plot, but rather the basic skeleton of the plot. I suppose I can make thicker ticks by hand w/ the xvline and xhline modules, but I'd rather not do it this way. Look into your matplotlibrc file, for the following lines: #axes.linewidth #xtick.major.size and three other adjustments. Not sure how to update these in code yet. Let me know when you figure out :) Also I often find that the xlabel is too close to the plot box (xaxis) is there a way to increase this distance besides making my own labels via text. I[3]: label = plt.xlabel (baskervilles) I[5]: label.set_position ? Type:instancemethod Base Class:type 'instancemethod' String Form:bound method Text.set_position of matplotlib.text.Text object at 0x98f5bac Namespace:Interactive File: /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/text.py Definition:label.set_position(self, xy) Docstring: Set the (*x*, *y*) position of the text ACCEPTS: (x,y) Thanks, Matthew -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Gökhan -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] How to increase axis and tick linesize?
Not sure how to update these in code yet. Let me know when you figure out :) http://matplotlib.sourceforge.net/users/artists.html#axis-containers Also I often find that the xlabel is too close to the plot box (xaxis) is there a way to increase this distance besides making my own labels via text. I[3]: label = plt.xlabel (baskervilles) I[5]: label.set_position ? Type: instancemethod Base Class: type 'instancemethod' String Form: bound method Text.set_position of matplotlib.text.Text object at 0x98f5bac Namespace: Interactive File: /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/text.py Definition: label.set_position(self, xy) Docstring: Set the (*x*, *y*) position of the text ACCEPTS: (x,y) Alternatively, ax=gca() ax.xaxis.labelpad=15 # pad in points Regards, -JJ -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Basemap interp
I'm trying to interpolate from one grid to another using Basemap's interp function. It seems to want the lat and lon axis of the new grid to have the same shape: 3524 if xout.shape != yout.shape: 3535 raise ValueError, 'xout and yout must have same shape!' The grid I'm interpolating to is 144 by 72 I'm calling it as interp(x,lon,lat,plon,plat) where lon and plon are numpy arrays with shape (144,) lat has shape (73,) plat has shape(72,) and x has shape (72, 144) Does interp() really only work if the target grid is square? - Andrew Charles -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users