Re: [Matplotlib-users] Where Do I Report MPL Guide Issues?
When I come back tonight I will try to fix the errors for you. -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Where Do I Report MPL Guide Issues?
If you are interested in contributing to matplotlib check out this link: http://matplotlib.sourceforge.net/faq/howto_faq.html#contributing-howto The PDF is not the "original source", it's a product of the sphinx documentation system I think so contributing happens in simple plain text files. You can send a patch then. Regards, Philipp -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Trouble gridding irregularly spaced data
Hi, I'm trying to grid irregularly spaced data, such that the convex hull of the data is not rectangular. Specifically, all my data lies in an equilateral triangle inside the unit circle. I found: http://www.scipy.org/Cookbook/Matplotlib/Gridding_irregularly_spaced_data and tried the suggested technique. For my grid, I made a square of the min and max of my data. However, it had problems: ... File "/home/guest/.local/lib/python2.6/site-packages/matplotlib/delaunay/triangulate.py", line 125, in _compute_convex_hull hull.append(edges.pop(hull[-1])) KeyError: 0 Should I expect matplotlib.mlab.griddata to work with a dataset like this? I know that I can use hexbin, but it'd be really nice to see contours explicitly. -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] half-filled markers, two-colors
wrote: > ...maybe dividing the markers up into 2, 3, or 4 sections would be > useful too. > ... There's a gallery example doing that in general, making pie-charts out of the markers: http://matplotlib.sourceforge.net/examples/api/scatter_piecharts.html although I think my demo of it shows off its data-representation better: # Piechart markers from matplotlib gallery, thanks to Manuel Metz for the original example # CPHLewis, 2010. import math import numpy as np import matplotlib.pyplot as plt def payoff(x,y): return x*y*400 def outcome_xwins(x,y): return x/(x+y) def outcome_ywins(x,y): return y/(x+y) x_cases = [ .25, .5, .75] y_cases = [ .33, .5, .66] outcomes = [('x wins', outcome_xwins, 'blue'), ('y wins', outcome_ywins, 'green')] #the name, calculation, and plotting color for categories of outcome fig = plt.figure() ax = fig.add_subplot(111) ax.set_title('Small multiples: pie charts calculated based on (x,y)') legend_once = True #At each point in the plot we calculate everything about the outcomes. for x in x_cases: for y in y_cases: size = payoff(x,y) start_at = 0 for result in outcomes: result_share = result[1](x,y) xpt = [0] + np.cos(np.linspace(2*math.pi*start_at, 2*math.pi*(result_share+start_at), 10)).tolist() ypt = [0] + np.sin(np.linspace(2*math.pi*start_at, 2*math.pi*(result_share+start_at), 10)).tolist() xypt = zip(xpt, ypt) ax.scatter([x],[y], marker = (xypt, 0), s = size, facecolor = result[2], label=result[0]) start_at = start_at + result_share if legend_once: ax.legend() #don't know why this isn't picking up the labels. legend_once = False plt.show() -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] half-filled markers, two-colors
On Mon, Feb 15, 2010 at 5:22 PM, John Hunter wrote: > Very nice and thorough work. I think this should be included, but > I'll wait to hear from other developers before committing. Could you > confirm that the unit tests pass? > import matplotlib matplotlib.test() > Confirmed on rev 8133: Ran 124 tests in 341.585s FAILED (KNOWNFAIL=2, errors=2) and the errors were something to do with hexbin extents and the figimage method. > I think the markerangle would also be a useful contribution, though it > would render some of the markers redundant (eg triangle left, right, > etc, would all just be triangles with different angles...) > That was a concern I had as well, but I suppose > ^ v < (etc) could just be considered shortcuts to particular angles. Presumably, we would not be removing them. Correct? Also, is the standard to have the angle specified in degrees? So what is more useful: markerangle or markerdeg? The other difference is that when one specifies fillstyle='left', then it would only apply to the marker at 0 degrees. Whereas, marker='v', fillstyle='left', markerangle=0 would correspond to marker='^', fillstyle='right', markerangle=180 (or something like that). -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] turning off tick labels
Hi Jeff, thanks for your quick reply. Unfortunately, the line you sent me doesn't have any effect on the plot, either before or after turning off the tick labels. Do you have another suggestion? Cheers, Jan On Sun, Feb 14, 2010 at 11:28 PM, Jeffrey Blackburne wrote: > > On Feb 14, 2010, at 5:41 PM, Jan Strube wrote: > > Dear matplotters, >> >> I'm trying to follow >> http://matplotlib.sourceforge.net/examples/pylab_examples/ >> ganged_plots.html >> as an example how to turn of the ticks in the case of shared x axes. >> The tick labels are gone, but unfortunately, matplotlib still plots a >> '1e5' on the axis for which I have turned off the tick labels. >> Please see the attached file for the problem >> >> How can I also switch of the exponent? >> >> Thanks, >>Jan >> > > > Try this: > > ax.xaxis.set_major_formatter(mpl.ticker.ScalarFormatter(useOffset=False)) > > where 'ax' is the name of the top subplot. > > Good luck, > Jeff > > -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] graph suggestion
http://www.graphviz.org/ ? On Sun, Feb 14, 2010 at 5:35 AM, Mag Gam wrote: > I manage 300 servers at my university lab. I would like to map out all > the cron entries into a nice graph but I am not sure what would be > appropriate. Can someone please suggest what would be ideal? > > TIA > > > -- > SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, > Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW > http://p.sf.net/sfu/solaris-dev2dev > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] half-filled markers, two-colors
On Mon, Feb 15, 2010 at 5:59 PM, T J wrote: > On Sun, Feb 14, 2010 at 2:49 PM, T J wrote: >> I ran across: >> >> http://old.nabble.com/half-filled-markers-td24003576.html >> >> The name "fillstyle" can give the wrong impression about what is being >> filled. For example, see the comment here: >> >> >> http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg13074.html >> >> It's probably too late, but would "markerfillstyle" be a better name for >> this? >> >> Also, the current implementation fills half of the marker with the >> markerfacecolor and doesn't fill the marker at all for the other half. >> I think a neat (and simple) feature would be for users to specify two >> colors. Perhaps 'markerfacecolor2'. The change to the code is >> minimal, but the functionality it brings is quite flexible. >> markerfacecolor2 can default to 'none' to maintain current >> functionality. >> >> Should I file a ticket for this? >> > > I went ahead and implemented this. The user can now specify > 'markercoloralt'. In the process, I finished the "half-marker" code > for all remaining filled_markers. The diff is attached, which also > includes a fix for bug #560720: > > > https://sourceforge.net/tracker/?func=detail&aid=2952236&group_id=80706&atid=560720 > > Please comment. If there are no comments in a few days, I'll file a ticket. > > A picture demonstrating this functionality is attached. Demos for all > filled markers can be obtained here: > > http://www.filedropper.com/filledmarkers > > Note, the diff contains the script used to generate the pictures. More > generally, I wonder if there should be a 'markerangle' keyword. I can > probably push through and implement this, but I'd like to hear what > people think about it. Very nice and thorough work. I think this should be included, but I'll wait to hear from other developers before committing. Could you confirm that the unit tests pass? >>> import matplotlib >>> matplotlib.test() I think the markerangle would also be a useful contribution, though it would render some of the markers redundant (eg triangle left, right, etc, would all just be triangles with different angles...) Many thanks, JDH -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] DateFormatter + Latex issue
Hello list, If I use DateFormatter with latex and lines breaks like this >>> DateFormatter("\n \n %b") I get an latex error: http://pastebin.com/m5b186ded Although, if I do not use the line breaks, >>> DateFormatter("%b") The problem disappears. Below is a script that reproduces what I'm talking about: #Example: from pylabimport * from matplotlib import rcParams rcParams['text.usetex'] = True fig = figure() ax = fig.add_subplot(111) fig.subplots_adjust(bottom=0.2) t = arange(100,110,.1) u = sin(t) v = cos(t) quiver([t],[[0]*len(t)],u,v) major = DayLocator([10,04]) minor = DayLocator() majorF = DateFormatter("\n \n %b") # problem #majorF = DateFormatter("%b") # no problem minorF = DateFormatter('%d') ax.xaxis.set_major_locator(major) ax.xaxis.set_minor_locator(minor) ax.xaxis.set_major_formatter(majorF) ax.xaxis.set_minor_formatter(minorF) gca().xaxis_date() title(r"$\alpha \beta \gamma \delta$") show() I'm using the latest svn version with qt4 as backend. Thanks, Filipe -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Pydot graphs in matplotlib?
I'm curious if anyone knows a good way to embed pydot (http://code.google.com/p/pydot/) graphs (or really, any graphviz-style graphs) inside matplotlib somehow. I could easily write out a png or something from pydot and then imshow it, but that seems very kludgy. Is there some way to load svg or other vector data into matplotlib to be shown inside a figure? -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] half-filled markers, two-colors
TJ, I think this current implementation and adding a marker rotation key word would be wonderful. When I get stuck doing GIS work, I end up using split markers very often. It's quite useful. Now's probably not the time, but maybe dividing the markers up into 2, 3, or 4 sections would be useful too. But perhaps at that point it'd be easier to create half and quarter markers and then rotate accordingly as the user makes multiple calls to plot. I dunno...just thinking aloud. This is a great contribution. Thanks a lot! -paul > -Original Message- > From: T J [mailto:tjhn...@gmail.com] > Sent: Monday, February 15, 2010 4:00 PM > To: Matplotlib Users > Subject: Re: [Matplotlib-users] half-filled markers, two-colors > > On Sun, Feb 14, 2010 at 2:49 PM, T J wrote: > > I ran across: > > > > http://old.nabble.com/half-filled-markers-td24003576.html > > > > The name "fillstyle" can give the wrong impression about what is being > > filled. For example, see the comment here: > > > > http://www.mail-archive.com/matplotlib- > us...@lists.sourceforge.net/msg13074.html > > > > It's probably too late, but would "markerfillstyle" be a better name > for this? > > > > Also, the current implementation fills half of the marker with the > > markerfacecolor and doesn't fill the marker at all for the other half. > > I think a neat (and simple) feature would be for users to specify two > > colors. Perhaps 'markerfacecolor2'. The change to the code is > > minimal, but the functionality it brings is quite flexible. > > markerfacecolor2 can default to 'none' to maintain current > > functionality. > > > > Should I file a ticket for this? > > > > I went ahead and implemented this. The user can now specify > 'markercoloralt'. In the process, I finished the "half-marker" code > for all remaining filled_markers. The diff is attached, which also > includes a fix for bug #560720: > > > https://sourceforge.net/tracker/?func=detail&aid=2952236&group_id=80706&a > tid=560720 > > Please comment. If there are no comments in a few days, I'll file a > ticket. > > A picture demonstrating this functionality is attached. Demos for all > filled markers can be obtained here: > > http://www.filedropper.com/filledmarkers > > Note, the diff contains the script used to generate the pictures. More > generally, I wonder if there should be a 'markerangle' keyword. I can > probably push through and implement this, but I'd like to hear what > people think about it. -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Placing a marker at specific places where lines join?
Tim Michelsen wrote: > Hello, > I have a similar problem to: >> Suppose I plot a line from (0,0) to (1,1.5) to (2,2). Now I want to mark >> (1,1.5) with a green circle. How is that done? > Your problem is not similar to the above; the problem above is solved with a simple call to "plot". > I am performing a curve fit and also showing a distribution in my plot. > In order to help the reader to evaluate the result I would like to draw > certain > boundaries (vertical and horizontal line). > While I am aware on how to draw such lines, I would like to know wheather > there > are some functions in matplotlib which help me to retrieve the coordinates > > a) at which two curves intersect > b) at which a distribution reaches a certain value? > I think this is strictly a computational problem, not a plotting problem, so I suggest you post the question to the numpy or scipy lists. Eric > Example: > How do I get the y-axis value which is reached by the green curve in > http://matplotlib.sourceforge.net/_images/histogram_demo_extended_021.png > a x-axis value of in 175? > > I could proably use a solver from numpy like > http://docs.scipy.org/doc/numpy/reference/generated/numpy.linalg.solve.html#numpy.linalg.solve > but if I plot a distribution, the equation of the envelove is unknown at the > first place. > > I'd appreciate your help or pointers to examples. > > Thanks a lot in advance, > Timmie > > > > -- > SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, > Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW > http://p.sf.net/sfu/solaris-dev2dev > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] save image from array?
Hi Nico, I'm pretty sure the functionality is buried in there but unfortunately I couldn't figure out how to put it into the imsave function, so for now I think you have to resort to using PIL to do this. Gary R. Nico Schlömer wrote: > Hi, > > I see that with imsave() it's possible to save an image based on its > cmap. Is there also functionality in matplotlib to to store a file > based on RGB(alpha) information? > > Cheers, > Nico -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] forcing a plot to appear
Hi, I am trying to develop an application that I can run inside the ipython shell. One of my methods creates a plot, asks the user to make a choice based on that plot, and then creates another plot that displays the chosen set of information. If the choices are made with a qt or wx dialogue, everything goes fine. If I try to get the choice by asking the user to type the information into the shell, neither plot appears until after the choice is made. I have tried show() and draw() but neither make any difference. thanks for any help Ken Dere -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] turning off tick labels
Yes, yes! what he said... Thanks a lot JJ. Dear developers, would it make sense to have setp(axes1.get_xticklabels(), visible=False) also automatically set axes1.xaxis.offsetText.set_visible(False) ? Cheers, Jan On Mon, Feb 15, 2010 at 5:10 PM, Jae-Joon Lee wrote: > Try > > ax1.xaxis.offsetText.set_visible(False) > > where ax1 is the upper axes. > > Regards, > > -JJ > > > On Mon, Feb 15, 2010 at 4:50 AM, Jan Strube wrote: > > Hi Jeff, > > thanks for your quick reply. > > Unfortunately, the line you sent me doesn't have any effect on the plot, > > either before or after turning off the tick labels. > > Do you have another suggestion? > > Cheers, > > Jan > > On Sun, Feb 14, 2010 at 11:28 PM, Jeffrey Blackburne > wrote: > >> > >> On Feb 14, 2010, at 5:41 PM, Jan Strube wrote: > >> > >>> Dear matplotters, > >>> > >>> I'm trying to follow > >>> > >>> > http://matplotlib.sourceforge.net/examples/pylab_examples/ganged_plots.html > >>> as an example how to turn of the ticks in the case of shared x axes. > >>> The tick labels are gone, but unfortunately, matplotlib still plots a > >>> '1e5' on the axis for which I have turned off the tick labels. > >>> Please see the attached file for the problem > >>> > >>> How can I also switch of the exponent? > >>> > >>> Thanks, > >>>Jan > >> > >> > >> Try this: > >> > >> > ax.xaxis.set_major_formatter(mpl.ticker.ScalarFormatter(useOffset=False)) > >> > >> where 'ax' is the name of the top subplot. > >> > >> Good luck, > >> Jeff > >> > > > > > > > -- > > SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, > > Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW > > http://p.sf.net/sfu/solaris-dev2dev > > ___ > > Matplotlib-users mailing list > > Matplotlib-users@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > > > -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] agg_buffer_to_array.py
All, This error: The debugged program raised the exception unhandled AttributeError "'FigureCanvasMac' object has no attribute 'buffer_rgba'" File: /Users/darnold/Documents/temp/Matplotlib/PylabExamples/agg_buffer_to_array.py, Line: 16 is raised by the following script on my Macbook. # agg_buffer_to_array.py import matplotlib matplotlib.use('macosx') from pylab import figure, show import numpy as np # make an agg figure fig = figure() ax = fig.add_subplot(111) ax.plot([1,2,3]) ax.set_title('a simple figure') fig.canvas.draw() # grab rhe pixel buffer and dumpy it into a numpy array buf = fig.canvas.buffer_rgba(0,0) l, b, w, h = fig.bbox.bounds X = np.fromstring(buf, np.uint8) X.shape = h,w,4 # now display the array X as an Axes in a new figure fig2 = figure() ax2 = fig2.add_subplot(111, frameon=False) ax2.imshow(X) show() This is captured from: http://matplotlib.sourceforge.net/examples/pylab_examples/agg_buffer_to_array.html With: matplotlib.use('Agg') Nothing happens at all. With --verbose-helpful, yields the following: $HOME=/Users/darnold CONFIGDIR=/Users/darnold/.matplotlib matplotlib data path /Library/Frameworks/Python.framework/Versions/6.0.0/lib/python2.6/site-packages/matplotlib/mpl-data loaded rc file /Users/darnold/.matplotlib/matplotlibrc matplotlib version 0.99.1.1 verbose.level helpful interactive is False units is False platform is darwin Using fontManager instance from /Users/darnold/.matplotlib/fontList.cache backend agg version v2.2 findfont: Matching :family=sans-serif:style=normal:variant=normal:weight=normal:stretch=normal:size=medium to Bitstream Vera Sans (/Library/Frameworks/Python.framework/Versions/4.3.0/lib/python2.5/site-packages/matplotlib-0.98.5.2n2-py2.5-macosx-10.3-fat.egg/matplotlib/mpl-data/fonts/ttf/Vera.ttf) with score of 0.00 findfont: Matching :family=sans-serif:style=normal:variant=normal:weight=normal:stretch=normal:size=large to Bitstream Vera Sans (/Library/Frameworks/Python.framework/Versions/4.3.0/lib/python2.5/site-packages/matplotlib-0.98.5.2n2-py2.5-macosx-10.3-fat.egg/matplotlib/mpl-data/fonts/ttf/Vera.ttf) with score of 0.00 Both matplotlib.use('tkagg') and matplotlib.use('wxagg') work as they should. David.-- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] identification of color bars
> As far as I can see, it is the other way around, i.e., mappables > (e.g., images) know about the colorbar they are connected. Well yeah, that'd be even better. I'll check out the API. -- Hints would still be appreciated of course. --Nico -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Easy come easy go
On Sun, Feb 14, 2010 at 10:36 PM, David Arnold wrote: > All, > > This example: > http://matplotlib.sourceforge.net/examples/event_handling/keypress_demo.html > > Raises this exception o my Macbook when the key 's' is pressed: > > The debugged program raised the exception unhandled TypeError > "save_figure() takes exactly 1 argument (2 given)" > File: > /Library/Frameworks/Python.framework/Versions/6.0.0/lib/python2.6/site-packages/matplotlib/backend_bases.py, > Line: 1703 > I had reported this "s" key-handling issue before at http://old.nabble.com/Assigning-%22k%22-key-for-xscaling-td27262672.html (By the way, I and Matthias expanding the key-handling functionality a little bit further -configuring and deassigning keys etc... Maybe by means of this e-mail someone can review the patch at that mail and apply to the trunk) And yes I am getting a similar error when I hit "s" using Qt4Agg backend on MPL svn8105 I[1]: plt.plot(range(10)) O[1]: [] I[2]: --- TypeError Traceback (most recent call last) /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/backends/backend_qt4.pyc in keyPressEvent(self, event) 150 def keyPressEvent( self, event ): 151 key = self._get_key( event ) --> 152 FigureCanvasBase.key_press_event( self, key ) 153 if DEBUG: print 'key press', key 154 /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/backend_bases.pyc in key_press_event(self, key, guiEvent) 1290 s = 'key_press_event' 1291 event = KeyEvent(s, self, key, self._lastx, self._lasty, guiEvent=guiEvent) -> 1292 self.callbacks.process(s, event) 1293 1294 def key_release_event(self, key, guiEvent=None): /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/cbook.pyc in process(self, s, *args, **kwargs) 167 self._check_signal(s) 168 for func in self.callbacks[s].values(): --> 169 func(*args, **kwargs) 170 171 /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/backend_bases.pyc in key_press(self, event) 1890 self.canvas.toolbar.zoom() 1891 elif event.key == s: -> 1892 self.canvas.toolbar.save_figure(self.canvas.toolbar) 1893 1894 if event.inaxes is None: TypeError: save_figure() takes exactly 1 argument (2 given) [gse...@ccn various]$ python sysinfo.py Platform : Linux-2.6.31.9-174.fc12.i686.PAE-i686-with-fedora-12-Constantine Python : ('CPython', 'tags/r262', '71600') IPython : 0.10 NumPy: 1.5.0.dev8038 Matplotlib : 1.0.svn (python setupegg.py develop newer shows matplotlib.__version__ correctly :) Thanks. > > David > > -- > SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, > Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW > http://p.sf.net/sfu/solaris-dev2dev > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -- Gökhan -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] identification of color bars
On Mon, Feb 15, 2010 at 12:25 PM, Nico Schlömer wrote: > Well, it's related to the TikZ converter I'm writing. After having > created the plot, the script is of course totally oblivious to what > exact commands were used. > I was thinking that there is still some sort of bond between the color > bar and its parent plot after their creation, e.g., for when the color > map of the main plot is changed. -- Is that not the case? I doubt it. As far as I can see, it is the other way around, i.e., mappables (e.g., images) know about the colorbar they are connected. But I hope some other developers can confirm (or dispute) this. For this kind of work, you need to understand some of internals of matplotlib, and I recommend you to go through the matplotlib sources. Regards, -JJ > > --Nico > > > > On Mon, Feb 15, 2010 at 6:16 PM, Jae-Joon Lee wrote: >> Is there any reason that you need to find out which axes is a color >> bar axes from the list of axes? Can you just keep references to >> colorbars you create? >> >> cbar = colorbar() >> cax = cbar.ax >> >> cax is the axes instance of the colobar you just created. >> >> Regards, >> >> -JJ >> >> >> On Mon, Feb 15, 2010 at 12:04 PM, Nico Schlömer >> wrote: >>> Hi, >>> >>> when plotting a color bar with a plot in matplotlib, the color bar >>> gets treated internally as Axes. >>> >>> With two main plots, each of which comes with a color bar, one structurally >>> gets >>> >>> >>> >>> >>> >>> >>> >>> (that is, a Figure has for childres Axes). To find out which one of >>> those is a color bar, I basically inspect their children an look for >>> Arrays with shape (256,), which is what color bars look like. That's >>> ugly of course, but it kind of works(tm). :) >>> >>> I'm having problems, though, with associating color bars with the >>> specific plot. Can I rely on the rule that an Axes -- if it has a >>> color bar --, is immediately followed by the corresponding (color bar) >>> Axes environment? Are there any other properties I could check to >>> identify color bars? (Tried get_label to no avail.) >>> >>> Cheers, >>> Nico >>> >>> -- >>> SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, >>> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW >>> http://p.sf.net/sfu/solaris-dev2dev >>> ___ >>> Matplotlib-users mailing list >>> Matplotlib-users@lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >>> >> > -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Easy come easy go
I cannot reproduce this error both with 0.99.1 maintenance branch and the current svn (with GtkAgg backend). What version of matplotlib and what backend are you using? http://matplotlib.sourceforge.net/faq/troubleshooting_faq.html Regards, -JJ On Sun, Feb 14, 2010 at 11:36 PM, David Arnold wrote: > All, > > This example: > http://matplotlib.sourceforge.net/examples/event_handling/keypress_demo.html > > Raises this exception o my Macbook when the key 's' is pressed: > > The debugged program raised the exception unhandled TypeError > "save_figure() takes exactly 1 argument (2 given)" > File: > /Library/Frameworks/Python.framework/Versions/6.0.0/lib/python2.6/site-packages/matplotlib/backend_bases.py, > Line: 1703 > > David > -- > SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, > Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW > http://p.sf.net/sfu/solaris-dev2dev > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Arrow question/request
On Mon, Feb 15, 2010 at 2:32 AM, rcnelson wrote: > 1) Are there any plans or would it make sense to add another keyword to the > pyplot.arrow function that allows you to choose the arrow class you would > like to use? The default could be FancyArrow so that the original usage of > pyplot.arrow will not be affected. The axes.arrow function - which it looks > like it gets called by the pyplot.arrow function - could then convert the > input arguments into the form necessary for the class you choose. > I recommend you to use "annotate" (see below). Because most of these things are already addressed by "annotate", I don't see any immediate need to enhance "arrow". But maybe it would be a good idea to mention about "annotate" in the "arrow" documentation and vice versa. > 2) Or... Is there a simple way that you can call the arrow function with > start and end points in data coordinates, but have the arrow parameters > calculated in normalized figure coordinates? I think FancyArrow calculates > the head and body points using a line perpendicular to the line of the arrow > in data coordinates, which I think is the source of my problem (? -- at > least that is what I found doing some test calculations on my own). However, > if I call the pyplot.arrow function with the following keywords, > 'trasform=fig.transFigure, figure=fig' (as per the Artist tutorial, see > below), then the arrow looks okay, but it needs to be positioned in > normalized figure coordinates and it does not move when you zoom or > translate the plot. > I guess you can just use "annotate" (with empty string) for your purpose. See the the example below. http://matplotlib.sourceforge.net/users/annotations_guide.html#annotating-with-arrow Let me know if it does not fits your need. Regards, -JJ -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] identification of color bars
Well, it's related to the TikZ converter I'm writing. After having created the plot, the script is of course totally oblivious to what exact commands were used. I was thinking that there is still some sort of bond between the color bar and its parent plot after their creation, e.g., for when the color map of the main plot is changed. -- Is that not the case? --Nico On Mon, Feb 15, 2010 at 6:16 PM, Jae-Joon Lee wrote: > Is there any reason that you need to find out which axes is a color > bar axes from the list of axes? Can you just keep references to > colorbars you create? > > cbar = colorbar() > cax = cbar.ax > > cax is the axes instance of the colobar you just created. > > Regards, > > -JJ > > > On Mon, Feb 15, 2010 at 12:04 PM, Nico Schlömer > wrote: >> Hi, >> >> when plotting a color bar with a plot in matplotlib, the color bar >> gets treated internally as Axes. >> >> With two main plots, each of which comes with a color bar, one structurally >> gets >> >> >> >> >> >> >> >> (that is, a Figure has for childres Axes). To find out which one of >> those is a color bar, I basically inspect their children an look for >> Arrays with shape (256,), which is what color bars look like. That's >> ugly of course, but it kind of works(tm). :) >> >> I'm having problems, though, with associating color bars with the >> specific plot. Can I rely on the rule that an Axes -- if it has a >> color bar --, is immediately followed by the corresponding (color bar) >> Axes environment? Are there any other properties I could check to >> identify color bars? (Tried get_label to no avail.) >> >> Cheers, >> Nico >> >> -- >> SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, >> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW >> http://p.sf.net/sfu/solaris-dev2dev >> ___ >> Matplotlib-users mailing list >> Matplotlib-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> > -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] identification of color bars
Is there any reason that you need to find out which axes is a color bar axes from the list of axes? Can you just keep references to colorbars you create? cbar = colorbar() cax = cbar.ax cax is the axes instance of the colobar you just created. Regards, -JJ On Mon, Feb 15, 2010 at 12:04 PM, Nico Schlömer wrote: > Hi, > > when plotting a color bar with a plot in matplotlib, the color bar > gets treated internally as Axes. > > With two main plots, each of which comes with a color bar, one structurally > gets > > > > > > > > (that is, a Figure has for childres Axes). To find out which one of > those is a color bar, I basically inspect their children an look for > Arrays with shape (256,), which is what color bars look like. That's > ugly of course, but it kind of works(tm). :) > > I'm having problems, though, with associating color bars with the > specific plot. Can I rely on the rule that an Axes -- if it has a > color bar --, is immediately followed by the corresponding (color bar) > Axes environment? Are there any other properties I could check to > identify color bars? (Tried get_label to no avail.) > > Cheers, > Nico > > -- > SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, > Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW > http://p.sf.net/sfu/solaris-dev2dev > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] simple GTK agg animation with patches
Thought I would post this as a simple GTKagg animation with patches (after John Hunter fixed it for me :-): import pygtk, gobject import matplotlib matplotlib.use('GTKAgg') import numpy as np import matplotlib.pyplot as plt import pylab from matplotlib.patches import CirclePolygon, Polygon fig = plt.figure(figsize=(10,6)) ax = fig.add_subplot(111, autoscale_on=False ) canvas = fig.canvas plt.axis([-1, 7, -0.5, 2.2]) def update_line(): global x, y print update_line.cnt_tot if update_line.background is None: update_line.background = canvas.copy_from_bbox(ax.bbox) canvas.restore_region(update_line.background) x_cir = 1.0 + 0.003*update_line.cnt if update_line.cir is None: cir = CirclePolygon((x_cir, 1), 0.3, animated=True, \ resolution=12, lw=2 ) ax.add_patch(cir) update_line.cir = cir else: update_line.cir._xy = x_cir, 1 update_line.cir._update_transform() ax.draw_artist(update_line.cir) canvas.blit(ax.bbox) if update_line.direction == 0: update_line.cnt += 1 update_line.cnt_tot += 1 if update_line.cnt > 500: update_line.direction = 1 else: update_line.cnt -= 1 update_line.cnt_tot += 1 if update_line.cnt < 100: update_line.direction = 0 return update_line.cnt<10 update_line.cnt = 0 update_line.cnt_tot = 0 update_line.direction = 0 update_line.background = None update_line.cir = None def start_anim(event): gobject.idle_add(update_line) canvas.mpl_disconnect(start_anim.cid) start_anim.cid = canvas.mpl_connect('draw_event', start_anim) plt.show() -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] memory leak for GTKAgg animation
Hi John - Yes thanks again! This did it. Plus it is a valuable lesson - it never occurred to me to look at the base class to find more useful methods. To make this cleaner I will post the complete simple working example after this message. best, John -Original Message- From: John Hunter [mailto:jdh2...@gmail.com] Sent: Sunday, February 14, 2010 7:39 PM To: John Jameson Cc: matplotlib-users@lists.sourceforge.net; Michael Droettboom Subject: Re: [Matplotlib-users] memory leak for GTKAgg animation On Sat, Feb 13, 2010 at 2:53 PM, John Jameson wrote: > HI, > I find the very basic animation below has a memory leak (my pagefile usage > number keeps growing in the Windows XP Windows Task Manager Performance > graph).I don't see this with the "animation_blit_gtk.py" example on: > > http://matplotlib.sourceforge.net/examples/index.html > > (which I used as a starting point for this). In "animation_blit_gtk.py" the > set_ydata() routine is used to update the line for the animation and this > does not leak. But if you call plot again with the new y_data (instead of > using set_ydata), this leaks too. Anyone have an idea on how to stop the > leak? This isn't a memory leak. The problem is that you keep adding new patches to the axes when you want just one with different data. Eg, in your loop, run this code, and you will see that the number of patches is growing: x_cir = 1.0 + 0.003*update_line.cnt cir = CirclePolygon((x_cir, 1), 0.3, animated=True, \ resolution=12, lw=2 ) ax.add_patch(cir) ax.draw_artist(cir) print 'num patches=%d, mem usage=%d'%( len(ax.patches), cbook.report_memory(update_line.cnt)) canvas.blit(ax.bbox) You should add just one patch and then manipulate the data. In this case, you are using a CirclePolygon which derives from RegularPolygon and so you can update the "xy" property http://matplotlib.sourceforge.net/api/artist_api.html#matplotlib.patches.Reg ularPolygon But on testing this it looks like there is a bug in that the set_xy property setter is ignored. I worked around this in the func below by setting the private variable directly, but this looks like a bug we need to fix (Michael, shouldn't we respect the xy passed in in patches.RegularPolygon._set_xy ?). In the meantime, the following workaround should work for you w/o leaking def update_line(): global x, y print update_line.cnt if update_line.background is None: update_line.background = canvas.copy_from_bbox(ax.bbox) canvas.restore_region(update_line.background) x_cir = 1.0 + 0.003*update_line.cnt if update_line.cir is None: cir = CirclePolygon((x_cir, 1), 0.3, animated=True, \ resolution=12, lw=2 ) ax.add_patch(cir) update_line.cir = cir else: update_line.cir._xy = x_cir, 1 update_line.cir._update_transform() ax.draw_artist(update_line.cir) print 'num patches=%d, xy=%s, mem usage=%d'%( len(ax.patches), update_line.cir.xy, cbook.report_memory(update_line.cnt)) canvas.blit(ax.bbox) if update_line.direction == 0: update_line.cnt += 1 if update_line.cnt > 500: update_line.direction = 1 else: update_line.cnt -= 1 if update_line.cnt < 100: update_line.direction = 0 return update_line.cnt<100 update_line.cnt = 0 update_line.direction = 0 update_line.background = None update_line.cir = None -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] turning off tick labels
Try ax1.xaxis.offsetText.set_visible(False) where ax1 is the upper axes. Regards, -JJ On Mon, Feb 15, 2010 at 4:50 AM, Jan Strube wrote: > Hi Jeff, > thanks for your quick reply. > Unfortunately, the line you sent me doesn't have any effect on the plot, > either before or after turning off the tick labels. > Do you have another suggestion? > Cheers, > Jan > On Sun, Feb 14, 2010 at 11:28 PM, Jeffrey Blackburne wrote: >> >> On Feb 14, 2010, at 5:41 PM, Jan Strube wrote: >> >>> Dear matplotters, >>> >>> I'm trying to follow >>> >>> http://matplotlib.sourceforge.net/examples/pylab_examples/ganged_plots.html >>> as an example how to turn of the ticks in the case of shared x axes. >>> The tick labels are gone, but unfortunately, matplotlib still plots a >>> '1e5' on the axis for which I have turned off the tick labels. >>> Please see the attached file for the problem >>> >>> How can I also switch of the exponent? >>> >>> Thanks, >>> Jan >> >> >> Try this: >> >> ax.xaxis.set_major_formatter(mpl.ticker.ScalarFormatter(useOffset=False)) >> >> where 'ax' is the name of the top subplot. >> >> Good luck, >> Jeff >> > > > -- > SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, > Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW > http://p.sf.net/sfu/solaris-dev2dev > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] identification of color bars
Hi, when plotting a color bar with a plot in matplotlib, the color bar gets treated internally as Axes. With two main plots, each of which comes with a color bar, one structurally gets (that is, a Figure has for childres Axes). To find out which one of those is a color bar, I basically inspect their children an look for Arrays with shape (256,), which is what color bars look like. That's ugly of course, but it kind of works(tm). :) I'm having problems, though, with associating color bars with the specific plot. Can I rely on the rule that an Axes -- if it has a color bar --, is immediately followed by the corresponding (color bar) Axes environment? Are there any other properties I could check to identify color bars? (Tried get_label to no avail.) Cheers, Nico -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] tabbed figure browsing..
I have a script that calls several subroutines which each draw a figure (TkAgg backend). When I call show() at the end of the script all the figures pop up no problem, but when your producing 20+ figures its a bit overwhelming! It'd be great if I could have just one plot window with each figure as a tab in that window - is this possible from matplotlib? -- Cheers, Nick Schurch Data Analysis Group (The Barton Group), School of Life Sciences, University of Dundee, Dow St, Dundee, DD1 5EH, Scotland, UK Tel: +44 1382 388707 Fax: +44 1382 345 893 -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] turning off tick labels
Can you send a minimal working example that shows the problem? On Feb 15, 2010, at 4:50 AM, Jan Strube wrote: > Hi Jeff, > > thanks for your quick reply. > Unfortunately, the line you sent me doesn't have any effect on the > plot, either before or after turning off the tick labels. > > Do you have another suggestion? > > Cheers, > Jan > > On Sun, Feb 14, 2010 at 11:28 PM, Jeffrey Blackburne > wrote: > > On Feb 14, 2010, at 5:41 PM, Jan Strube wrote: > > Dear matplotters, > > I'm trying to follow > http://matplotlib.sourceforge.net/examples/pylab_examples/ > ganged_plots.html > as an example how to turn of the ticks in the case of shared x axes. > The tick labels are gone, but unfortunately, matplotlib still plots > a '1e5' on the axis for which I have turned off the tick labels. > Please see the attached file for the problem > > How can I also switch of the exponent? > > Thanks, >Jan > > > Try this: > > ax.xaxis.set_major_formatter(mpl.ticker.ScalarFormatter > (useOffset=False)) > > where 'ax' is the name of the top subplot. > > Good luck, > Jeff > > > -- > > SOLARIS 10 is the OS for Data Centers - provides features such as > DTrace, > Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW > http://p.sf.net/sfu/solaris- > dev2dev___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Import bug for numpy >= 2.0
On 2010-02-14 11:23 AM, Charles R Harris wrote: > Lines 147-151 of __init__ need to be changed to > > import numpy > nn = numpy.__version__.split('.') > if not (int(nn[0]) > 1 or int(nn[0]) == 1 and int(nn[1]) >= 1): > raise ImportError( > 'numpy 1.1 or later is required; you have %s' % numpy.__version__) It's been noted and fixed in SVN. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Placing a marker at specific places where lines join?
Hi, Phillip. don't know why the mail would be returned. The address I see above is correct. sierra_mtni...@sbcglobal.net. The only thing I can think of is that yahoo mail wanted you to allow you to ask for permission. Beats me. Frankly, I've never really liked the reply format of mail lists. I use Thunderbird on Win. Sometimes I see messages in my inbox from someone and wonder are they trying for a private comm or just sending me a courtesy msg so that I should follow up on the list. Then there's Reply vs Reply All, and some filter problems. The latter can produce what I call the boomerang effect. Mail intended for me goes right into the list folder. There are goblins out there. :-) To me all this can be solved by one word, Forum. Not a mail list. Aside from the possible cost (to the Python Org?), comm is much clearer on them. Perhaps one disadvantage is that some people apparently have some bizarre form of e-mail that is not suitable for them. Otherwise, I have no idea why they are not more often used. html not allowed? The rules just vary too much to follow this. Same with bottom vs top posting in NGs. My view, and I'm not trying to be unfriendly here, is if one doesn't like what they see, ignore it, and don't respond. +NG. Expect the unexpected. The warriors and self appointed moderators hang out there. Some are just begging for a fight. +e-mail. If you aren't communicating with your friends, misunderstanding often prevail. +Forums: Almost bliss. I must belong to 30 of them. I must say that I am really puzzled by your comments about a footnote. I really don't use them much. I've probably posted thousands of msgs to NGs, forums, mail lists and I've never heard word one about footnotes. I use them as I see fit, and that's not very often. In fact, I like your use of the footnote below. I'm not even going to touch etiquette. I'd be really impressed if anyone follows them. I'll just say this. Internet communication by any of the methods above is sometimes just plain weird. It takes patience to use these methods. That includes personal e-mail. Someone should write a book about it. Preferably a shrink of psychologist. IMHO, the internet is generally meant for easy and informal communications, and not studied carefully written posts. That doesn't mean some care isn't needed. I see matters as a running dialogs. Both parties need to ask questions about clarity. Too much is often assumed.Maybe I'll write about it. Let's not hold our breaths. Hey, no footnotes used above. VBG Cheers. On 2/14/2010 1:39 PM, Philipp Bender wrote: > Hi Wayne, > > (I wanted to answer you directly but the mail came back, don't know why) > I have several points that > you really should work on if you expect anyone to answer to your mails in > future. First, you should check the destination of your messages. I got at > least three of your messages addressed only for me, you obviously wanted to > send them to the list but they only reached me. So I didn't answer because the > mailing list should be an open and searchable discussion platform and I didn't > want to forward your message to the list or something like that. Please check > that carefully in future. > > The next thing is that everyone must have the feeling that you completely > ignore replies. This link here should have been an alert for you: > > http://www.freebsd.org/doc/en/articles/mailing-list-faq/etiquette.html > > This was posted as reply to one of your mails. One thing explained there is to > not > cite the original mail after the own reply, instead you should cite the > original issue at the beginning or in parts directly before the parts of the > answer. See below: > > >>> How to do foo bar? >>> > Just like that. > > You see? The same thing about your footnotes*. > > Another thing is the HTML I received from your adress two times -- HTML has > neither benefit nor a good reputation in mailing lists. I delete HTML mails > without reading it in most cases. > > And, but that's maybe more a personal thing, I find it very unfriendly to ask > in the subject and write in the body something like "(see subject)" -- we take > the time to read your message, in respect to that you also should take the > time to ask a complete question. > > Please don't misunderstand this message -- I don't want to blame you, I want > to help you and make sure that you get answers to your questions in future. > > Regards, > Philipp > > * like this one here. They don't help you, they don't explain anything, they > don't help me reading the message, they have absolutely no benefit. > > -- > SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, > Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW > http://p.sf.net/sfu/solaris-dev2dev > ___ > Matplotlib-users mailing list > Matplotlib-users@lis
Re: [Matplotlib-users] 16bit tiff support?
Jeff Whitaker wrote: > Philipp Lies wrote: >> On 02/12/2010 07:49 PM, Eric Firing wrote: >> >>> Philipp Lies wrote: >>> Hi, is there a backend that supports 16bit tiff images? > > The macosx backend supports tiff. Thanks, but I need a linux backend :-/ >>> Can you just use png, and use the netpbm utilities or ImageMagick >>> convert program to go to and from tiff? >>> >> Would be 'dirty' but acceptable if matplotlib would support saving >> uncompressed grayscale uint16 png files. But saving nxm uint16 arrays >> leads to nxmx3 float arrays which do not even closely resemble my >> original data. >> Example: >> A >> array([[47705, 11865, 739, 16941, 37700], >> [64321, 26860, 49945, 63556, 13498], >> [ 2676, 7720, 5995, 22399, 32735], >> [56577, 34443, 6636, 23409, 61331], >> [ 1020, 26013, 34677, 37262, 36136]], dtype=uint16) >> imsave('t.png',A) >> B = imread('t.png') >> B[:,:,0] >> >> array([[ 1., 0., 0., 0., 0.74117649], >> [ 0.49803922, 0.19607843, 1., 0.5529412 , 0. ], >> [ 0., 0., 0., 0., 0.48627451], >> [ 1., 0.57647061, 0., 0.01960784, 0.71372551], >> [ 0., 0.14509805, 0.58823532, 0.72941178, 0.6669]], >> dtype=float32) >> >> >> According to the website GDK supports tiff but that's wrong: >>> import matplotlib >>> matplotlib.use('GDK') >>> import matplotlib.pyplot as pyplot >>> pyplot.imsave(arr=X, fname='test.tif') >>> Traceback (most recent call last): File "", line 1, in File "/usr/lib/pymodules/python2.6/matplotlib/pyplot.py", line 1425, in imsave return _imsave(*args, **kwargs) File "/usr/lib/pymodules/python2.6/matplotlib/image.py", line 813, in imsave fig.savefig(fname, dpi=1, format=format) File "/usr/lib/pymodules/python2.6/matplotlib/figure.py", line 1033, in savefig self.canvas.print_figure(*args, **kwargs) File "/usr/lib/pymodules/python2.6/matplotlib/backend_bases.py", line 1420, in print_figure '%s.' % (format, ', '.join(formats))) ValueError: Format "tif" is not supported. Supported formats: emf, eps, pdf, png, ps, raw, rgba, svg, svgz. >>> matplotlib.backends.backend >>> 'gdk' matplotlib 0.99.0 python 2.6.4 ubuntu karmic x64 If matplotlib cannot provide tiff support, does someone know an alternative? PIL doesn't work either, at least not intuitively. -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] 16bit tiff support?
Philipp Lies wrote: > On 02/12/2010 07:49 PM, Eric Firing wrote: > >> Philipp Lies wrote: >> >>> Hi, >>> >>> is there a backend that supports 16bit tiff images? >>> The macosx backend supports tiff. -Jeff >> Can you just use png, and use the netpbm utilities or ImageMagick >> convert program to go to and from tiff? >> > Would be 'dirty' but acceptable if matplotlib would support saving > uncompressed grayscale uint16 png files. But saving nxm uint16 arrays > leads to nxmx3 float arrays which do not even closely resemble my > original data. > Example: > A > array([[47705, 11865, 739, 16941, 37700], > [64321, 26860, 49945, 63556, 13498], > [ 2676, 7720, 5995, 22399, 32735], > [56577, 34443, 6636, 23409, 61331], > [ 1020, 26013, 34677, 37262, 36136]], dtype=uint16) > imsave('t.png',A) > B = imread('t.png') > B[:,:,0] > > array([[ 1., 0., 0., 0., 0.74117649], > [ 0.49803922, 0.19607843, 1., 0.5529412 , 0. ], > [ 0., 0., 0., 0., 0.48627451], > [ 1., 0.57647061, 0., 0.01960784, 0.71372551], > [ 0., 0.14509805, 0.58823532, 0.72941178, 0.6669]], > dtype=float32) > > > >>> According to the website GDK supports tiff but that's wrong: >>> >>> >> import matplotlib >> matplotlib.use('GDK') >> import matplotlib.pyplot as pyplot >> pyplot.imsave(arr=X, fname='test.tif') >> >>> Traceback (most recent call last): >>> File "", line 1, in >>> File "/usr/lib/pymodules/python2.6/matplotlib/pyplot.py", line 1425, >>> in imsave >>> return _imsave(*args, **kwargs) >>> File "/usr/lib/pymodules/python2.6/matplotlib/image.py", line 813, in >>> imsave >>> fig.savefig(fname, dpi=1, format=format) >>> File "/usr/lib/pymodules/python2.6/matplotlib/figure.py", line 1033, >>> in savefig >>> self.canvas.print_figure(*args, **kwargs) >>> File "/usr/lib/pymodules/python2.6/matplotlib/backend_bases.py", line >>> 1420, in print_figure >>> '%s.' % (format, ', '.join(formats))) >>> ValueError: Format "tif" is not supported. >>> Supported formats: emf, eps, pdf, png, ps, raw, rgba, svg, svgz. >>> >> matplotlib.backends.backend >> >>> 'gdk' >>> >>> matplotlib 0.99.0 python 2.6.4 ubuntu karmic x64 >>> >>> If matplotlib cannot provide tiff support, does someone know an >>> alternative? PIL doesn't work either, at least not intuitively. >>> >>> Cheers >>> >>> Philipp >>> >>> > > -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Looking for a Compiled Demo of MPL Graphics
Does anyone know where I can find a compiled demo that uses MPL grphics? I'd like, if possible, a Win version whose size is less than 10M, so that I can send it via e-mail, if necessary. It should use plot, so that someone can manipulate the plot with the navigation controls. At this point, I have no idea if that method is the fundamental graph tool or not. I suspect it is. If a mailable demo isn't available, maybe there's a web site that one can download such examples from? -- "Crime is way down. War is declining. And that's far from the good news." -- Steven Pinker (and other sources) Why is this true, but yet the media says otherwise? The media knows very well how to manipulate us (see limbic, emotion, $$). -- WTW -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Placing a marker at specific places where lines join?
Hello, I have a similar problem to: > Suppose I plot a line from (0,0) to (1,1.5) to (2,2). Now I want to mark > (1,1.5) with a green circle. How is that done? I am performing a curve fit and also showing a distribution in my plot. In order to help the reader to evaluate the result I would like to draw certain boundaries (vertical and horizontal line). While I am aware on how to draw such lines, I would like to know wheather there are some functions in matplotlib which help me to retrieve the coordinates a) at which two curves intersect b) at which a distribution reaches a certain value? Example: How do I get the y-axis value which is reached by the green curve in http://matplotlib.sourceforge.net/_images/histogram_demo_extended_021.png a x-axis value of in 175? I could proably use a solver from numpy like http://docs.scipy.org/doc/numpy/reference/generated/numpy.linalg.solve.html#numpy.linalg.solve but if I plot a distribution, the equation of the envelove is unknown at the first place. I'd appreciate your help or pointers to examples. Thanks a lot in advance, Timmie -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Enter Figure on Macs
I almost have a solution for this for the Mac OS X backend. I am stuck though at what I should pass to enter_notify_event and leave_notify_event for the guiEvent: def leave_notify_event(self, guiEvent=None): """ Backend derived classes should call this function when leaving canvas *guiEvent* the native UI event that generated the mpl event """ What are the requirements for guiEvent? If I call leave_notify_event without guiEvent, so guiEvent = None, then the example gives me the following error: enter_figure Figure(640x480) leave_figure Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/backend_bases.py", line 1416, in leave_notify_event self.callbacks.process('figure_leave_event', LocationEvent.lastevent) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/cbook.py", line 169, in process func(*args, **kwargs) File "test.py", line 23, in leave_figure print 'leave_figure', event.canvas.figure AttributeError: 'NoneType' object has no attribute 'canvas' So I guess I should pass some type of event object to enter|leave_notify_event. --Michiel. --- On Sun, 2/14/10, David Arnold wrote: > From: David Arnold > Subject: Re: [Matplotlib-users] Enter Figure on Macs > To: "John Hunter" > Cc: "Michiel de Hoon" , > matplotlib-users@lists.sourceforge.net > Date: Sunday, February 14, 2010, 11:50 PM > John, > > Only the wxagg worked. Here is the output: > > $HOME=/Users/darnold > CONFIGDIR=/Users/darnold/.matplotlib > matplotlib data path > /Library/Frameworks/Python.framework/Versions/6.0.0/lib/python2.6/site-packages/matplotlib/mpl-data > loaded rc file /Users/darnold/.matplotlib/matplotlibrc > matplotlib version 0.99.1.1 > verbose.level helpful > interactive is False > units is False > platform is darwin > Using fontManager instance from > /Users/darnold/.matplotlib/fontList.cache > backend WXAgg version 2.8.10.1 > findfont: Matching > :family=sans-serif:style=normal:variant=normal:weight=normal:stretch=normal:size=medium > to Bitstream Vera Sans > (/Library/Frameworks/Python.framework/Versions/4.3.0/lib/python2.5/site-packages/matplotlib-0.98.5.2n2-py2.5-macosx-10.3-fat.egg/matplotlib/mpl-data/fonts/ttf/Vera.ttf) > with score of 0.00 > findfont: Matching > :family=sans-serif:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0 > to Bitstream Vera Sans > (/Library/Frameworks/Python.framework/Versions/4.3.0/lib/python2.5/site-packages/matplotlib-0.98.5.2n2-py2.5-macosx-10.3-fat.egg/matplotlib/mpl-data/fonts/ttf/Vera.ttf) > with score of 0.00 > enter_figure Figure(640x480) > leave_figure Figure(640x480) > enter_figure Figure(640x480) > leave_figure Figure(640x480) > enter_figure Figure(640x480) > leave_figure Figure(640x480) > enter_figure Figure(640x480) > enter_axes Axes(0.125,0.536364;0.775x0.363636) > leave_axes Axes(0.125,0.536364;0.775x0.363636) > enter_axes Axes(0.125,0.1;0.775x0.363636) > leave_axes Axes(0.125,0.1;0.775x0.363636) > leave_figure Figure(640x480) > > > Did not work with macosx: > > $HOME=/Users/darnold > CONFIGDIR=/Users/darnold/.matplotlib > matplotlib data path > /Library/Frameworks/Python.framework/Versions/6.0.0/lib/python2.6/site-packages/matplotlib/mpl-data > loaded rc file /Users/darnold/.matplotlib/matplotlibrc > matplotlib version 0.99.1.1 > verbose.level helpful > interactive is False > units is False > platform is darwin > Using fontManager instance from > /Users/darnold/.matplotlib/fontList.cache > backend MacOSX version unknown > enter_axes Axes(0.125,0.536364;0.775x0.363636) > leave_axes Axes(0.125,0.536364;0.775x0.363636) > enter_axes Axes(0.125,0.1;0.775x0.363636) > leave_axes Axes(0.125,0.1;0.775x0.363636) > enter_axes Axes(0.125,0.1;0.775x0.363636) > leave_axes Axes(0.125,0.1;0.775x0.363636) > enter_axes Axes(0.125,0.536364;0.775x0.363636) > leave_axes Axes(0.125,0.536364;0.775x0.363636) > enter_axes Axes(0.125,0.1;0.775x0.363636) > leave_axes Axes(0.125,0.1;0.775x0.363636) > > > Did not work with tkagg: > > $HOME=/Users/darnold > CONFIGDIR=/Users/darnold/.matplotlib > matplotlib data path > /Library/Frameworks/Python.framework/Versions/6.0.0/lib/python2.6/site-packages/matplotlib/mpl-data > loaded rc file /Users/darnold/.matplotlib/matplotlibrc > matplotlib version 0.99.1.1 > verbose.level helpful > interactive is False > units is False > platform is darwin > Using fontManager instance from > /Users/darnold/.matplotlib/fontList.cache > backend TkAgg version 8.4 > findfont: Matching > :family=sans-serif:style=normal:variant=normal:weight=normal:stretch=normal:size=medium > to Bitstream Vera Sans > (/Library/Frameworks/Python.framework/Versions/4.3.0/lib/python2.5/site-packages/matplotlib-0.98.5.2n2-py2.5-macosx-10.3-fat.egg/matplotlib/mpl-data/fonts/ttf/Vera.ttf) > with score of 0.00 > findfont: Matching > :family=sans-serif:style=normal
Re: [Matplotlib-users] 16bit tiff support?
On 02/12/2010 07:49 PM, Eric Firing wrote: > Philipp Lies wrote: >> Hi, >> >> is there a backend that supports 16bit tiff images? > > Can you just use png, and use the netpbm utilities or ImageMagick > convert program to go to and from tiff? Would be 'dirty' but acceptable if matplotlib would support saving uncompressed grayscale uint16 png files. But saving nxm uint16 arrays leads to nxmx3 float arrays which do not even closely resemble my original data. Example: A array([[47705, 11865, 739, 16941, 37700], [64321, 26860, 49945, 63556, 13498], [ 2676, 7720, 5995, 22399, 32735], [56577, 34443, 6636, 23409, 61331], [ 1020, 26013, 34677, 37262, 36136]], dtype=uint16) imsave('t.png',A) B = imread('t.png') B[:,:,0] array([[ 1., 0., 0., 0., 0.74117649], [ 0.49803922, 0.19607843, 1., 0.5529412 , 0. ], [ 0., 0., 0., 0., 0.48627451], [ 1., 0.57647061, 0., 0.01960784, 0.71372551], [ 0., 0.14509805, 0.58823532, 0.72941178, 0.6669]], dtype=float32) >> According to the website GDK supports tiff but that's wrong: >> >> >>>import matplotlib >> >>>matplotlib.use('GDK') >> >>>import matplotlib.pyplot as pyplot >> >>>pyplot.imsave(arr=X, fname='test.tif') >> Traceback (most recent call last): >> File "", line 1, in >> File "/usr/lib/pymodules/python2.6/matplotlib/pyplot.py", line 1425, >> in imsave >> return _imsave(*args, **kwargs) >> File "/usr/lib/pymodules/python2.6/matplotlib/image.py", line 813, in >> imsave >> fig.savefig(fname, dpi=1, format=format) >> File "/usr/lib/pymodules/python2.6/matplotlib/figure.py", line 1033, >> in savefig >> self.canvas.print_figure(*args, **kwargs) >> File "/usr/lib/pymodules/python2.6/matplotlib/backend_bases.py", line >> 1420, in print_figure >> '%s.' % (format, ', '.join(formats))) >> ValueError: Format "tif" is not supported. >> Supported formats: emf, eps, pdf, png, ps, raw, rgba, svg, svgz. >> >>>matplotlib.backends.backend >> 'gdk' >> >> matplotlib 0.99.0 python 2.6.4 ubuntu karmic x64 >> >> If matplotlib cannot provide tiff support, does someone know an >> alternative? PIL doesn't work either, at least not intuitively. >> >> Cheers >> >> Philipp >> > -- Philipp Lies Max Planck Institute for Biological Cybernetics Computational Vision & Neuroscience Group Spemannstr. 41 D-72076 Tuebingen Germany Phone: +49-7071-601-1788 Fax:+49-7071-601-552 E-Mail: philipp.l...@tuebingen.mpg.de http://www.kyb.mpg.de/bethgegroup -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Enter Figure on Macs
On Mon, Feb 15, 2010 at 6:50 AM, Michiel de Hoon wrote: > I almost have a solution for this for the Mac OS X backend. I am stuck though > at what I should pass to enter_notify_event and leave_notify_event for the > guiEvent: > > def leave_notify_event(self, guiEvent=None): > """ > Backend derived classes should call this function when leaving > canvas > > *guiEvent* > the native UI event that generated the mpl event > > """ > > What are the requirements for guiEvent? If I call leave_notify_event without > guiEvent, so guiEvent = None, then the example gives me the following error: we don't make any assumptions about what kind of object the gui event is. We provide the GUI event because sometimes when using a specific backend, the user wants to drill into the GUI native event (eg a button press event) but we don't use it anywhere in the mpl frontend because this would break the abstraction. So if you have some event that is being fired at the UI level on figure enter, pass that in. It looks like you may be having a problem because the leave_notify_event is getting called more than once, or is called for a figure that has not been entered. Check the logic in backend_bases.FigureCanvasBase.leave_notify_event def leave_notify_event(self, guiEvent=None): """ Backend derived classes should call this function when leaving canvas *guiEvent* the native UI event that generated the mpl event """ self.callbacks.process('figure_leave_event', LocationEvent.lastevent) LocationEvent.lastevent = None It looks like your figure_leave_event is being triggered with LocationEvent.lastevent = None (so it is not a problem with your guiEvent). This could happen if a leave event was processed *before* and enter event (which sets the lastevent), or if a leave event was processed twice. Hopefully this will help you drill down into the source of the problem JDH -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] tick labels in colorbar?
> cb.ax.set_yticklabels((r'$-\pi$', '0', r'$\pi$')) Works like a charm. Thanks! --Nico -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] tick labels in colorbar?
On Monday 15 February 2010 09:28:10 Nico Schlömer wrote: > Hi, > thanks for the suggestion. > > > ax.set_xticks((-pi,pi)) > > ax.set_xticklabels(('$-\pi$','$\pi$')) > > I guess color bars are a little special in the sense that > >AttributeError: Colorbar instance has no attribute 'set_yticklabels' > > The tick positions are given not by set_yticks either, but as an option > >pylab.colorbar(ticks=(-pi,0,pi)) > > at the instatiation of the bar. It would indeed be very handy if the > bars acted like axes. Hi Nico, nontheless you can use the axes-method to display your preferred labels. The colorbar has its axes as attribute 'ax' (see also my small example below): cb.ax.set_yticklabels((r'$-\pi$', '0', r'$\pi$')) Kind regards, Matthias --- import matplotlib as mpl mpl.rc('text', usetex=True) import matplotlib.pyplot as plt import numpy as np ax = plt.axes() plt.imshow(np.reshape(np.pi*np.arange(-2, 3, 0.5), (2, 5))) cb = plt.colorbar() cb.set_ticks((-np.pi, 0.0, np.pi)) cb.ax.set_yticklabels((r'$-\pi$', '0', r'$\pi$')) plt.show() -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] How to draw a rectangle using event handler ?
Hi Yagua, On Friday 12 February 2010 17:04:27 Yagua Rovi wrote: > Hello world! > I am displaying on my screen a set of data corresponding to points > defined by a longitude and latitude. > The display is fine with the command imshow (mydata ,...) > > I would like now associate to the application a callback that draw a > rectangle on two consecutive left mouse's button press defined by its two > opposite vertices. > (also returns points) and a right click button that erases the rectangle. Why don't you want for select the rectangle using the rectangle selector? I attached an example (modified version of example 'rectangle_selector.py') showing its usage. You can delete lines using the key 'd' or 'D'. Furthermore I attached a script, which uses button_press_event s as you proposed above. I hope at least one of the examples helps you. Kind regards, Matthias draw_rectangle_using_button_press_events.py Description: application/python draw_rectangle_using_rectangle_selector.py Description: application/python -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] save image from array?
Hi, I see that with imsave() it's possible to save an image based on its cmap. Is there also functionality in matplotlib to to store a file based on RGB(alpha) information? Cheers, Nico -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] turning off tick labels
Hi Jeff, thanks for your quick reply. Unfortunately, the line you sent me doesn't have any effect on the plot, either before or after turning off the tick labels. Do you have another suggestion? Cheers, Jan On Sun, Feb 14, 2010 at 11:28 PM, Jeffrey Blackburne wrote: > > On Feb 14, 2010, at 5:41 PM, Jan Strube wrote: > > Dear matplotters, >> >> I'm trying to follow >> http://matplotlib.sourceforge.net/examples/pylab_examples/ >> ganged_plots.html >> as an example how to turn of the ticks in the case of shared x axes. >> The tick labels are gone, but unfortunately, matplotlib still plots a >> '1e5' on the axis for which I have turned off the tick labels. >> Please see the attached file for the problem >> >> How can I also switch of the exponent? >> >> Thanks, >>Jan >> > > > Try this: > > ax.xaxis.set_major_formatter(mpl.ticker.ScalarFormatter(useOffset=False)) > > where 'ax' is the name of the top subplot. > > Good luck, > Jeff > > -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] tick labels in colorbar?
Hi, thanks for the suggestion. > ax.set_xticks((-pi,pi)) > ax.set_xticklabels(('$-\pi$','$\pi$')) I guess color bars are a little special in the sense that AttributeError: Colorbar instance has no attribute 'set_yticklabels' The tick positions are given not by set_yticks either, but as an option pylab.colorbar(ticks=(-pi,0,pi)) at the instatiation of the bar. It would indeed be very handy if the bars acted like axes. Cheers, Nico -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users