[Matplotlib-users] circle not drawn correctly when axis is flipped
I'm trying to plot a circle AND flip an axis of the plot, but this leads to an inverted circle (diamond) being drawn. Is there any way to do this 'neatly' (besides, for example, manually editing the axis labels or using a many-sided polygon to fake a circle)? Note that the circle renders correctly with the PS backend Example code to reproduce the problem: import pylab as p x = p.rand(17) y = p.rand(17) p.scatter(x,y) p.gca().add_patch(p.Circle((0.5,0.5),0.2,fill=False)) p.axis([0.,1.,1.,0.]) p.gca().set_aspect('equal') p.show() Thanks for any help! Matt - SF.Net email is sponsored by: Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] histogram question
I wrote the following code to do this for me...it is not entirely general (in the sense that it doesn't accept all kwargs beyond bins and hatch) and also allows me to do my own normalization But you should be able to use it pretty easily. def open_hist(arr,bins=10,norm=None,hatch=None): import matplotlib as mpl import pylab # Get all of the scaling right by allowing pylab to do it. d = pylab.hist(arr,bins) ax = pylab.gca() for i in d[2]: ax.patches.remove(i) width = d[1][1]-d[1][0] if norm is None: norm = 1. else: norm = float(norm) # Determine the vertices of the no-line histogram. verts = [] for i in range(len(d[0])): if i==0: x = d[1][i] y = 0. verts.append((x,y)) if i==len(d[0])-1: x = d[1][i] y = d[0][i]/norm verts.append((x,y)) x = d[1][i]+width verts.append((x,y)) y = 0. verts.append((x,y)) else: x = d[1][i] y = d[0][i]/norm verts.append((x,y)) x = d[1][i]+width verts.append((x,y)) # Let pylab do its thing p = pylab.Polygon(verts,transform=ax.transData,hatch=hatch) p.set_fill(0) ax.add_patch(p) On Mon, 24 Sep 2007, Tommy Grav wrote: > I need to generate a set of histograms, but would like to plot only > the "skyline" > of the histogram, and leave out the vertical lines where adjencent > bars touch. > I have looked at the docs, but nothing jumped out at me as the right > keyword > for this. Is this possible? and if so, how? > > Cheers > Tommy > > - > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] nD plotting
This demonstrates the *solution*--the problem is that scatter() does not automagically perform color mapping for the edge and face colors. Perhaps this is a 'feature', but if so (or even if not) maybe the documentation should be clarified (I figured 'c' and 'color' were equivalent, like other mpl functions, but this is NOT the case for scatter; none of the 'color' kwargs are automatically mapped). On Tue, 14 Aug 2007, Joe Shmoe wrote: > Matthew Auger wrote the following on 08/13/2007 11:15 AM: >> I'm trying to make high-dimensionality scatter plots, but I've run into a >> couple of issues. I'm using scatter() but including both edge and face >> color mapping; I doubt this will provide a meaningful display, but I'd >> like to try it and see Unfortunately, passing data arrays to facecolor >> and edgecolor does *not* map the data arrays to colors--instead I get >> gray edges and/or faces. As a side note, none of the 'usual' keyword >> shortcuts (ec, fc, lw for example) work with scatter(). >> > > Does the following demonstrate the issue? > > -- > import pylab > x = [a for a in range(10)] > y = [a**2 for a in range(10)] > s = [a**3 for a in range(10)] > c = x > ec = c[:] > ec.reverse() > > a = pylab.scatter(x,y,s, > facecolor=pylab.cm.jet(c), > edgecolor=pylab.cm.jet(ec)) > > print a._facecolors > print a._edgecolors > > pylab.show() > - > > So we create a scatter plot with different sizes, facecolors, and > edgecolors. The collection clearly has the facecolors/edgecolors > stored. However, resulting image does not show the different > facecolors/edgecolors. Each circle is given the default > facecolor/edgecolor (as axes.py indicates it should)...but It seems > like something is not getting updated. Comments anyone? ...seems > like a bug at first glance... > > Confirmed with version 0.90.1. > > - > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] nD plotting
I'm trying to make high-dimensionality scatter plots, but I've run into a couple of issues. I'm using scatter() but including both edge and face color mapping; I doubt this will provide a meaningful display, but I'd like to try it and see Unfortunately, passing data arrays to facecolor and edgecolor does *not* map the data arrays to colors--instead I get gray edges and/or faces. As a side note, none of the 'usual' keyword shortcuts (ec, fc, lw for example) work with scatter(). I was also wondering if it was possible to access 'luminence' or something similar to try to map another dimension onto the plot. For some data, (x,y,size,color,luminence) would provide very meaningful ways to view five continuous dimensions. Thanks! Matt - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] text element mixed coordinate systems
Hi...I'm interested in plotting text elements with the X value in data coordinates and the Y value in axis coordinates (in this way I could plot labels at the top of the axes that would respond to zooming/panning in the X-direction but would *always* remain at the top of the axes as long as the X-coord was still in the axes, for example). Is this possible? Also, it seems the only differences between axvline and vlines are that vlines can take multiple lines as input and vlines uses data coords to set the y limits while axvline uses axis coords. It seems simpler to have one function that takes an optional argument to choose whether to use data or axis coordinates for the y range (and maybe even for the x value...ie producing the same functionality that I seek above). Thanks for any help/suggestions! Matt - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] os x backends
I think we want to keep matplotlib associated with the OS X Framework install of python; if we installed the macports version, am I correct in assuming that we could just dump the resulting python modules (eg. gtk, tkinter, and matplotlib) into the Framework install's site-packages dir (or more likely my own PYTHONPATH dir) and disregard the macports distro of python? On Fri, 1 Jun 2007, Jochen Küpper wrote: On 31.05.2007, at 20:34, Jeff Whitaker wrote: The fink matplotlib package uses GTKAgg as the default backend, and works fine over an ssh tunnel. The admin will have to: 0) make sure X11.app (and the X11 SDK) is installed. 1) install fink 2) run 'fink selfupdate' 3) run 'fink install matplotlib-py25' (and wait a few hours for everything to compile). Same holds for MacPorts -- it has matplotlib in variants tk, gtk2, and wxPython. I guess in your case you would need to convince yur Admin to install MacPorts, or install as a normal user, which might work -- that would then include gtk2 or wxWidgets as necessary. Greetings, Jochen - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] os x backends
I've recently needed to use matplotlib remotely from a 'server' running OS X. The server does not have GTK on it, and the server's version of Tk is bound to Aqua instead of X11 and I therefore can't remotely spawn a matplotlib GUI window. My question: Does anyone know of an *easy* way to get a backend running that will allow me to push windows through ssh X11 forwarding? I don't have administrative access on the server, so I'm trying to find the simplest solution possible for the administrator to implement--presumably this rules out GTK Thanks! Matt - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] problem with saving eps and ps with GTKAgg backend (and current head of SVN)
I was having the same problem, but the recent xpdf thread pointed me to a/the solution. I was able to successfully run your script by outputting as eps instead of ps (which produced truncated output, as you were experiencing). Matt On Thu, 10 May 2007, Johann Cohen-Tanugi wrote: > Well, matplotlib starts with a canvas bigger than my screen (vertically only) > but in the end it seems to resize it so everything fits in. I can see the > whole drawing and the bottom toolbar. Again, saving in png or jpg works > perfectly and of course I checked that gv was not cutting the graph when > displaying it. > I just tried to use GTK as a backend, and ipython tells me that there are > "non implemented" errors on my script > I attach it here. > thanks! > Johann > > Darren Dale wrote: >> On Wednesday 09 May 2007 12:19:24 pm Johann Cohen-Tanugi wrote: >> >>> I am creating a "big" drawing ( figure(figsize=(16,20)) ), and when I >>> try to save it in eps/ps form, it mishandle the overall size and only >>> save a portion of the drawing. Saving in png or jpg works fine though. >>> Any idea? >>> >> >> On my system, you cant create a figure that is larger than the monitor >> size, unless I use a non-gui backend like agg or ps. It doesnt matter >> whether I save an eps, png, or jpg. Also, make sure your postscript viewer >> is not truncating the page due to an inappropriate page size setting. >> >> Darren >> - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] problem with raw_input and event handlers
Hi all...I am connecting an event handler that collects user input via raw_input. When using GTKAgg as my backend, this works but requires the user to first hit 'enter' before the raw_input prompt is displayed--this extra step of hitting enter is quite cumbersome! When I use the TKAgg backend, I get this error message: Exception in Tkinter callback Traceback (most recent call last): File "/local/lib/python2.5/lib-tk/Tkinter.py", line 1403, in __call__ return self.func(*args) File "/local/lib/python2.5/site-packages/matplotlib/backends/backend_tkagg.py", line 208, in button_press_event FigureCanvasBase.button_press_event(self, x, y, num, guiEvent=event) File "/local/lib/python2.5/site-packages/matplotlib/backend_bases.py", line 911, in button_press_event func(mouseevent) File "tktest.py", line 15, in printpoint color = str(raw_input("Enter color: ")) RuntimeError: can't re-enter readline I am using Tcl/Tk 8.4.14, python2.5, and matplotlib0.90. The test code I'm using follows. Thanks for any help! Matt - import pylab,scipy def printpoint(event): color = str(raw_input("Enter color: ")) text = "%d , %d" % (event.xdata,event.ydata) pylab.text(event.xdata,event.ydata,text,color=color) data = scipy.arange(100.) pylab.plot(data) pylab.connect('button_press_event',printpoint) - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] display GUI scientific notation
Ah...right. That works well enough (I believe that I originally had editted backend_bases to circumvent the format_coord call--clearly not the best solution)! I don't know of a good reason to *not* use the axis formatting, but perhaps an rcparam could control this? Thanks for the help Eric! - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] display GUI scientific notation
The GUI plots the x/y position of the cursor in data coordinates using scientific notation including only three significant digits (ie x=7.24e+03, y=20.2). The scientific notation is annoying but the lack of significant digits (ie 7.2457e+03) makes it impossible to fully use the GUI for interactive analyses. It would be nice if the cursor position denoted by the gui used the same coordinate formatting that the current axes use. Thus, if my axes are set to use something like 7.2f formatting for values less than 1e5, the cursor coordinate would be displayed in the same way (and instead of x=7.24e+03,y=20.1 the gui would read x=7245.70,y=20.1 when the cursor is at that coordinate position). I hope this clears things up! Matt On Tue, 20 Feb 2007, Darren Dale wrote: > On Tuesday 20 February 2007 7:40:18 pm Matthew Auger wrote: >> We are starting to use matplotlib to do some analysis of our data, but we >> are hampered by the unfortunate choice of significant digits in the GUI. >> I hacked the backends for 0.87.7 to display (many) more significant >> digits and I was wondering if anyone had any better suggestions (ie that I >> could implement directly into my code so others wouldn't need to >> continually hack their backends). Perhaps the GUI should follow the >> formatting of the axes? (Though this would again require a change to the >> backend) > > Could you be more specific? In what ways are you currently limited, and how > would you like matplotlib to behave? > > Darren > - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] display GUI scientific notation
We are starting to use matplotlib to do some analysis of our data, but we are hampered by the unfortunate choice of significant digits in the GUI. I hacked the backends for 0.87.7 to display (many) more significant digits and I was wondering if anyone had any better suggestions (ie that I could implement directly into my code so others wouldn't need to continually hack their backends). Perhaps the GUI should follow the formatting of the axes? (Though this would again require a change to the backend) Thanks! Matt - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users