Re: [Matplotlib-users] Polar plot - problem with negative values for radius
I am using a workaround now. But that is a hackery solution. Before plotting my data I convert it to dBs and limit it to the lowest value I want to display. Then I plot it using a regular polar plot with a custom formatting function that sets the tick labels with respect to the data offset. Since I use a custom Navigation-Toolbar anyways it was no big deal to add the few necessery lines of codes to handle the offset there, too. The plot now looks exactly as I want it. But: I'd still prefer using a scale that does all the work in the background. -- View this message in context: http://old.nabble.com/Polar-plot---problem-with-negative-values-for-radius-tp30936638p30975519.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: Pinpoint memory and threading errors before they happen. Find and fix more than 250 security defects in the development cycle. Locate bottlenecks in serial and parallel code that limit performance. http://p.sf.net/sfu/intel-dev2devfeb ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Polar plot - problem with negative values for radius
Ben, I should have mentioned that I already tried that. When I set the rscale to 'log' the plot crashes when zooming or mpl cannot even create it. Maybe some example code will help: from numpy import arange, sin, pi, cos, ones from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg from matplotlib.figure import Figure import Tkinter as Tk root = Tk.Tk() f = Figure(figsize=(5,4), dpi=100) ax = f.add_subplot(111, projection='polar') t = arange(0.0,2*pi,0.01) s1 = ones(len(t))*10 ax.set_rscale('log') ax.plot(t,s1) canvas = FigureCanvasTkAgg(f, master=root) canvas.show() canvas.get_tk_widget().pack(side=Tk.TOP, fill=Tk.BOTH, expand=1) toolbar = NavigationToolbar2TkAgg(canvas, root) toolbar.update() canvas._tkcanvas.pack(side=Tk.TOP, fill=Tk.BOTH, expand=1) Tk.mainloop() Using this code the plot will show up but you can see the 10^-1 and 10^-2 tick labels overlapping in the center. Ok, it shouldn't be a big deal to get rid of them. The major problem is if you try to zoom out, the tick labels move away from the center and if you try to zoom into the plot it eventually throws an exception ValueError: cannot convert float NaN to integer. If you try to plot smaller values (e.g. replacing the line 's1 = ones(len(t))*10' with 's1 = ones(len(t))') mpl also throws an ValueError exception and does not even create the plot. Let me know if you need full tracebacks. Btw: I am using Matplotlib 1.0.1 and Python 2.6.0 on Windows 64. -- View this message in context: http://old.nabble.com/Polar-plot---problem-with-negative-values-for-radius-tp30936638p30947935.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: Pinpoint memory and threading errors before they happen. Find and fix more than 250 security defects in the development cycle. Locate bottlenecks in serial and parallel code that limit performance. http://p.sf.net/sfu/intel-dev2devfeb ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Polar plot - problem with negative values for radius
Small update: I tried the very same code with MPL 1.0.1 and Python 2.5.0 on Linux 64 and Python 2.5.4 on Win32 and it runs w/o throwing any exceptions there! But: the behaviour is still not that what I expected. Still these issues are remaining: - the smallest magnitude (center magnitude in other words) is 0.1 and I'd like to display way smaller values - the smallest magnitude doesn't even change when zooming - the grid lines and ticks do not show as I'd expect (see my last message) when zooming That's why I'd rather stick to a linear scale, doing my own logarithmic conversion, limit my data at lowest value I need and just use an offset for the scale. -- View this message in context: http://old.nabble.com/Polar-plot---problem-with-negative-values-for-radius-tp30936638p30948265.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: Pinpoint memory and threading errors before they happen. Find and fix more than 250 security defects in the development cycle. Locate bottlenecks in serial and parallel code that limit performance. http://p.sf.net/sfu/intel-dev2devfeb ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Polar plot - problem with negative values for radius
On Thu, Feb 17, 2011 at 4:12 AM, Stephan Markus zw...@web.de wrote: Small update: I tried the very same code with MPL 1.0.1 and Python 2.5.0 on Linux 64 and Python 2.5.4 on Win32 and it runs w/o throwing any exceptions there! But: the behaviour is still not that what I expected. Still these issues are remaining: - the smallest magnitude (center magnitude in other words) is 0.1 and I'd like to display way smaller values - the smallest magnitude doesn't even change when zooming - the grid lines and ticks do not show as I'd expect (see my last message) when zooming That's why I'd rather stick to a linear scale, doing my own logarithmic conversion, limit my data at lowest value I need and just use an offset for the scale. I see what you mean. This problem is almost identical to another thread going on where we can't seem to correctly do log scale for 3d plots. The tick locators are in the wrong positions (the major ticks should be evenly spaced) and the error message is similar to one I have been encountering in mplot3d. I will look a little further into this and see if I can kill two birds with one stone... Ben Root -- The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: Pinpoint memory and threading errors before they happen. Find and fix more than 250 security defects in the development cycle. Locate bottlenecks in serial and parallel code that limit performance. http://p.sf.net/sfu/intel-dev2devfeb___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Polar plot - problem with negative values for radius
On Wed, Feb 16, 2011 at 9:16 AM, Stephan Markus zw...@web.de wrote: Hi, I am trying to display some complex values in a polar plot. Displaying linear magnitude vs. angle - of course - works without any issues. But I'd rather display the logarithmic magnitute vs. angle. Since the data for the radius gets negative then, it'll be wrapped around / rotated by 180deg by matplotlib. How can I display negative values for the radius w/o having them rotated by 180deg? Of course I can add an offset to the data before plotting it but since my plot is interactive and I use the xdata/ydata of events I'd like them to represent the real data, without an offset. I thought it might be possible to achieve with a custom transformation but I don't actually get it to work. -Stephan -- View this message in context: http://old.nabble.com/Polar-plot---problem-with-negative-values-for-radius-tp30936638p30936638.html Sent from the matplotlib - users mailing list archive at Nabble.com. Stephan, From the polar axes object, you can call ax.set_rscale('log') and that will automatically make the radial ticks scale and label the axes properly. You can then input the original data as you would without worry of negative values. Let us know how that works for you! Ben Root -- The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: Pinpoint memory and threading errors before they happen. Find and fix more than 250 security defects in the development cycle. Locate bottlenecks in serial and parallel code that limit performance. http://p.sf.net/sfu/intel-dev2devfeb___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] polar plot
2010/8/20 Michael Droettboom md...@stsci.edu: Yeah, it's my issue, but I'm not happy with fixing it. Currently, matplotlib forces the xticks (i.e., the theta ticks) to be at sensible values via .set_xticks() and .set_xlabels() (projections/polar.py). I'm coding a matplotlib extension package which has to clear the axes often, but restoring the major locators, the title and stuff after clearing. It was agnostic to the specialities of polar axes so far. Why and how are you restoring the major locator? It seems like that's the issue. I don't think preventing the theta locator from being changed is something we want to do. Polar plots (by default) just set fixed theta ticks at multiples of pi/4. My package provides support for Layers in matplotlib. And the layers' data can be changed, making a complete redraw of the axes a solution much easier to implement than dealing with the fuzzy API stuff directly. I don't need high-performance. When putting axes.clear(), the locator is being reset. In cartesian coords, it happens that I want a MaxNLocator(nbins=3) or similiar from time to time, and this must be restored then. For cartesian axes, if the user does not specify another locator, I'm setting the AutoLocator(), what is the same what the (cartesian) axes does. Dealing with the case no locator set (by using matplotlib default fallback) is neither nice nor straightforward. (It has to do with complicating the calling conventions. I would have to treat the case 'ignore [x|y]locator' specially.) It would maybe be a good solution to provide some abstract Axes.get_default_locators(), being public. Each SomeClass(Axes) can define what they understand under default locator. I would rather suggest to insert a new Locator class being aware of radians. It would suffice to return tick positions dividing 2 pi into an integer number of bins. It's not necessary to cover all the peculiarities of the old historic division system into 360 parts. Perhaps using FixedLocator, rather than explicitly setting the ticks using set_xticks (as polar plots currently do) would be better. However, the locator could still be changed, not really addressing your problem. Seems that you misunderstood my problem, if I'm not misunderstanding you :-) I have no problem with a mutable locator. (But the user has normally no access to the axes, only the Stack class changes the axes.) But right, I wanted to derive it from the Locator class framework, just specialising the location. For convenience, however, we could add a locator that given n, divides 2pi into n parts. Yes, and Ben's idea is quite nice, to make this accessible also to rectangular plots. This implies some simple thoughts on the view lims to take them into account when issuing the tick locations. Accompanying would be formatters in radians and degrees with adjustable precision (no autodetect necessary). Sure. Adding a radian formatter makes sense. If we go into details let's switch to -devel maybe? Friedrich -- Sell apps to millions through the Intel(R) Atom(Tm) Developer Program Be part of this innovative community and reach millions of netbook users worldwide. Take advantage of special opportunities to increase revenue and speed time-to-market. Join now, and jumpstart your future. http://p.sf.net/sfu/intel-atom-d2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] polar plot
On 08/19/2010 05:53 PM, Friedrich Romstedt wrote: 2010/8/19 Michael Droettboommd...@stsci.edu: On 08/18/2010 06:03 PM, Friedrich Romstedt wrote: Is the attached issue with a plain polar axes already fixed? I never encountered this before. 344 degrees happens to be 6.0 rad. I'm on svn 8626. How are you creating that graph? By default, polar plots don't do that. Yeah, it's my issue, but I'm not happy with fixing it. Currently, matplotlib forces the xticks (i.e., the theta ticks) to be at sensible values via .set_xticks() and .set_xlabels() (projections/polar.py). I'm coding a matplotlib extension package which has to clear the axes often, but restoring the major locators, the title and stuff after clearing. It was agnostic to the specialities of polar axes so far. Why and how are you restoring the major locator? It seems like that's the issue. I don't think preventing the theta locator from being changed is something we want to do. Polar plots (by default) just set fixed theta ticks at multiples of pi/4. I would rather suggest to insert a new Locator class being aware of radians. It would suffice to return tick positions dividing 2 pi into an integer number of bins. It's not necessary to cover all the peculiarities of the old historic division system into 360 parts. Perhaps using FixedLocator, rather than explicitly setting the ticks using set_xticks (as polar plots currently do) would be better. However, the locator could still be changed, not really addressing your problem. For convenience, however, we could add a locator that given n, divides 2pi into n parts. Accompanying would be formatters in radians and degrees with adjustable precision (no autodetect necessary). Sure. Adding a radian formatter makes sense. Mike -- Michael Droettboom Science Software Branch Space Telescope Science Institute Baltimore, Maryland, USA -- This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] polar plot
On Fri, Aug 20, 2010 at 8:33 AM, Michael Droettboom md...@stsci.edu wrote: On 08/19/2010 05:53 PM, Friedrich Romstedt wrote: 2010/8/19 Michael Droettboommd...@stsci.edu: On 08/18/2010 06:03 PM, Friedrich Romstedt wrote: Is the attached issue with a plain polar axes already fixed? I never encountered this before. 344 degrees happens to be 6.0 rad. I'm on svn 8626. How are you creating that graph? By default, polar plots don't do that. Yeah, it's my issue, but I'm not happy with fixing it. Currently, matplotlib forces the xticks (i.e., the theta ticks) to be at sensible values via .set_xticks() and .set_xlabels() (projections/polar.py). I'm coding a matplotlib extension package which has to clear the axes often, but restoring the major locators, the title and stuff after clearing. It was agnostic to the specialities of polar axes so far. Why and how are you restoring the major locator? It seems like that's the issue. I don't think preventing the theta locator from being changed is something we want to do. Polar plots (by default) just set fixed theta ticks at multiples of pi/4. I would rather suggest to insert a new Locator class being aware of radians. It would suffice to return tick positions dividing 2 pi into an integer number of bins. It's not necessary to cover all the peculiarities of the old historic division system into 360 parts. Perhaps using FixedLocator, rather than explicitly setting the ticks using set_xticks (as polar plots currently do) would be better. However, the locator could still be changed, not really addressing your problem. For convenience, however, we could add a locator that given n, divides 2pi into n parts. Accompanying would be formatters in radians and degrees with adjustable precision (no autodetect necessary). Sure. Adding a radian formatter makes sense. Just curious, this wouldn't have to be just for PolarPlots, right? Could it also be used for regular plots of sinusoids and such. Ben Root -- This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] polar plot
On 08/18/2010 06:03 PM, Friedrich Romstedt wrote: 2010/8/18 Michael Droettboommd...@stsci.edu: This bug (that the r-axis labels are in the wrong place) should now be fixed in r8651. This doesn't, unfortunately, address the original question about annular plots. Is the attached issue with a plain polar axes already fixed? I never encountered this before. 344 degrees happens to be 6.0 rad. I'm on svn 8626. How are you creating that graph? By default, polar plots don't do that. Mike -- Michael Droettboom Science Software Branch Space Telescope Science Institute Baltimore, Maryland, USA -- This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] polar plot
2010/8/19 Michael Droettboom md...@stsci.edu: On 08/18/2010 06:03 PM, Friedrich Romstedt wrote: Is the attached issue with a plain polar axes already fixed? I never encountered this before. 344 degrees happens to be 6.0 rad. I'm on svn 8626. How are you creating that graph? By default, polar plots don't do that. Yeah, it's my issue, but I'm not happy with fixing it. Currently, matplotlib forces the xticks (i.e., the theta ticks) to be at sensible values via .set_xticks() and .set_xlabels() (projections/polar.py). I'm coding a matplotlib extension package which has to clear the axes often, but restoring the major locators, the title and stuff after clearing. It was agnostic to the specialities of polar axes so far. I could say, if nothing is requested specially, treat it as a running system, but I see this as clumsy and error-prone at all. I would rather suggest to insert a new Locator class being aware of radians. It would suffice to return tick positions dividing 2 pi into an integer number of bins. It's not necessary to cover all the peculiarities of the old historic division system into 360 parts. Accompanying would be formatters in radians and degrees with adjustable precision (no autodetect necessary). Friedrich -- This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] polar plot
On Wed, Aug 18, 2010 at 8:03 AM, Nils Wagner nwag...@iam.uni-stuttgart.dewrote: Hi all, Is it possible to create a polar plot, where the lower bound of the radius is larger than zero ? I would like to plot an annulus. Any pointer would be appreciated. Thanks in advance Nils Nils, It appears that there is a .set_rmin() function, however, I don't think it does what we expect it to. I can't get an annulus, but it only plots the parts that are r = r_min (but r_min is at the origin, and the axis labels are in the wrong places...) Ben Root -- This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] polar plot
On Wed, 18 Aug 2010 08:51:31 -0500 Benjamin Root ben.r...@ou.edu wrote: On Wed, Aug 18, 2010 at 8:03 AM, Nils Wagner nwag...@iam.uni-stuttgart.dewrote: Hi all, Is it possible to create a polar plot, where the lower bound of the radius is larger than zero ? I would like to plot an annulus. Any pointer would be appreciated. Thanks in advance Nils Nils, It appears that there is a .set_rmin() function, however, I don't think it does what we expect it to. I can't get an annulus, but it only plots the parts that are r = r_min (but r_min is at the origin, and the axis labels are in the wrong places...) Ben Root Ben, Thank you for your reply. Please can you send me your example. Nils -- This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] polar plot
On 08/18/2010 09:51 AM, Benjamin Root wrote: On Wed, Aug 18, 2010 at 8:03 AM, Nils Wagner nwag...@iam.uni-stuttgart.de mailto:nwag...@iam.uni-stuttgart.de wrote: Hi all, Is it possible to create a polar plot, where the lower bound of the radius is larger than zero ? I would like to plot an annulus. Any pointer would be appreciated. Thanks in advance Nils Nils, It appears that there is a .set_rmin() function, however, I don't think it does what we expect it to. I can't get an annulus, but it only plots the parts that are r = r_min (but r_min is at the origin, and the axis labels are in the wrong places...) Ben Root This bug (that the r-axis labels are in the wrong place) should now be fixed in r8651. This doesn't, unfortunately, address the original question about annular plots. Mike -- Michael Droettboom Science Software Branch Space Telescope Science Institute Baltimore, Maryland, USA -- This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] polar plot
2010/8/18 Michael Droettboom md...@stsci.edu: This bug (that the r-axis labels are in the wrong place) should now be fixed in r8651. This doesn't, unfortunately, address the original question about annular plots. Is the attached issue with a plain polar axes already fixed? I never encountered this before. 344 degrees happens to be 6.0 rad. I'm on svn 8626. polar.pdf Description: Adobe PDF document -- This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] polar plot
On Wed, Aug 18, 2010 at 10:03 PM, Nils Wagner nwag...@iam.uni-stuttgart.de wrote: I would like to plot an annulus. With mpl_toolkits.axisartist, it is possible to make an axes of annulus. But, the resulting axes is not fully compatible with the original matplotlib axes. Most of the tick-related commands won't work and you need to use new commands provided by the axisartist module. Attached is a sample script and a screeshot. Also see these examples, http://matplotlib.sourceforge.net/examples/axes_grid/demo_floating_axes.html -JJ attachment: image.png demo_floating_axes.py Description: Binary data -- This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] polar plot fills entire plot while drawing line, bug or feature?
azerith wrote: Hi, I'm new to matplotlib and in need to draw a single impulse on a polar plot, but don't know how to do it, so i just draw a line using pylab.polar([0,0],[0,100],'g-') but when i draw shorter lines or pylab.polar([0,0],[0,0],'g-') i get the whole plot filled with green color, instead of a single dot or a very short line does anyone else has similar issue? is this a bug or a feature that i can turned off somewhere? i'm using ubuntu. Thank you for any help It's a bug. You probably have quite an old version of mpl. A shiny new version was just released, and if you can install it in place of the ubuntu package, that particular bug will go away. Eric -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] polar plot: problem with negative angles
The grid line will reappear if you set high enough resolution. plt.subplot(111, polar=True, resolution=100) This should be filed as a bug, though. I guess the current default for resolution is 1. I think this was to enable to draw a straight line in polar projection. However, my guess is that it has a side-effect that a angular gridline became a 0-length line connecting two identical points. -JJ On Sun, May 17, 2009 at 2:51 PM, Magnus Benjes magnus.ben...@googlemail.com wrote: Magnus Benjes wrote: Hello, in version 0.98.5.2 the polar plot still has a problem with negativ angles. The polarplot is drawing a circle when the angle changes from negativ to positiv (e.g. from -0.01 to +0.01). Your example works fine with svn. I don't recall whether the problem was fixed before the last release. I think it was. Thank you for the hint, in version 0.98.6 the polar plot has no problems with negativ angles any more. But now there are only gridlines in radial direction and the gridlines in angular direction are missing. Magnus -- Crystal Reports - New Free Runtime and 30 Day Trial Check out the new simplified licensing option that enables unlimited royalty-free distribution of the report engine for externally facing server and web deployment. http://p.sf.net/sfu/businessobjects ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Crystal Reports - New Free Runtime and 30 Day Trial Check out the new simplified licensing option that enables unlimited royalty-free distribution of the report engine for externally facing server and web deployment. http://p.sf.net/sfu/businessobjects ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Polar Plot: Extraneous Circles
mcdevitts wrote: Hello, I've been trying to implement a smith chart like a previous gentlemen on the list and have run into a similar problem. When my angle value goes from -pi to pi I get an extraneous circle from the interpolation. From the previous posts, I am under the impression that this is a known issue and has been corrected. Am I correct? If so, I am still having this issue using version 0.98.5.2 of matplotlib. Regards, Sean McDevitt Yes, this is known and was fixed on January 2. Can you update from svn? Eric -- Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Polar plot
Hi Tony, Thank you for the reply, the solutions you propose are fine in this case. But I'm trying to use the polar plot as a smith chart for an instrument and there i will receive data that is unknown but can be something like this: r = np.transpose(.1+np.arange ( 0 , 0.7 , 0.001)) theta = -4.5 * np.pi *r freq = r*10e9 data = np.multiply(r,np.exp(1j*theta)) ax.plot(angle(data),abs(data)) Any idea why Polar plot can't handle theta going from negative to positive radians? Jan Tony S Yu wrote: On Sep 17, 2008, at 1:59 AM, jan gillis wrote: Hello, I have a problem with polar plot, if i run the following code in matplotlib 0.98.3, polar plot is drawing a extra circle to go from angle -3.14159265 to angle 3.03753126. Is there a solution for this problem? import numpy as np from matplotlib.pyplot import figure, show, rc, grid # radar green, solid grid lines rc('grid', color='#316931', linewidth=1, linestyle='-') rc('xtick', labelsize=15) rc('ytick', labelsize=15) # force square figure and square axes looks better for polar, IMO fig = figure(figsize=(8,8)) ax = fig.add_axes([0.1, 0.1, 0.8, 0.8], polar=True, axisbg='#d5de9c') z = np.zeros((1,2000),complex) z.real = 0.2 z.imag = np.arange(-50,50,0.05) gamma_r = np.transpose((z-1)/(z+1)) ax.plot(np.angle(gamma_r), np.abs(gamma_r), '.-', zorder=0) Hi Jan, It looks like you get the circle because the angles you're plotting go from negative to positive radians in a weird way. The circle being drawn starts around 0 radians and goes clockwise by negative values. Then when it gets to - pi, it switches to positive indices, i.e. pi. Of course, these are the same points on a polar plot, but different angles, if you want to be consistent. Here are a couple of quick solutions, but there but there maybe better ways of handling this. # ~~ # get rid of the plot line above, and add the following theta = np.angle(gamma_r) mag = np.abs(gamma_r) # option 1 ordered = np.argsort(theta, axis=0).squeeze() ax.plot(theta[ordered], mag[ordered], '.-', zorder=0) # option 2 neg_theta = np.where(theta 0) theta[neg_theta] += 2 * np.pi ax.plot(theta, mag, '.-', zorder=0) # ~~ I hope that's helpful, -Tony ax.set_rmax(2.0) grid(True) show() Kind regards, Jean - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Polar plot
On Sep 17, 2008, at 1:59 AM, jan gillis wrote: Hello, I have a problem with polar plot, if i run the following code in matplotlib 0.98.3, polar plot is drawing a extra circle to go from angle -3.14159265 to angle 3.03753126. Is there a solution for this problem? import numpy as np from matplotlib.pyplot import figure, show, rc, grid # radar green, solid grid lines rc('grid', color='#316931', linewidth=1, linestyle='-') rc('xtick', labelsize=15) rc('ytick', labelsize=15) # force square figure and square axes looks better for polar, IMO fig = figure(figsize=(8,8)) ax = fig.add_axes([0.1, 0.1, 0.8, 0.8], polar=True, axisbg='#d5de9c') z = np.zeros((1,2000),complex) z.real = 0.2 z.imag = np.arange(-50,50,0.05) gamma_r = np.transpose((z-1)/(z+1)) ax.plot(np.angle(gamma_r), np.abs(gamma_r), '.-', zorder=0) Hi Jan, It looks like you get the circle because the angles you're plotting go from negative to positive radians in a weird way. The circle being drawn starts around 0 radians and goes clockwise by negative values. Then when it gets to - pi, it switches to positive indices, i.e. pi. Of course, these are the same points on a polar plot, but different angles, if you want to be consistent. Here are a couple of quick solutions, but there but there maybe better ways of handling this. # ~~ # get rid of the plot line above, and add the following theta = np.angle(gamma_r) mag = np.abs(gamma_r) # option 1 ordered = np.argsort(theta, axis=0).squeeze() ax.plot(theta[ordered], mag[ordered], '.-', zorder=0) # option 2 neg_theta = np.where(theta 0) theta[neg_theta] += 2 * np.pi ax.plot(theta, mag, '.-', zorder=0) # ~~ I hope that's helpful, -Tony ax.set_rmax(2.0) grid(True) show() Kind regards, Jean -- Jan Gillis Ghent University IMEC vzw - INTEC Sint-Pietersnieuwstraat 41 B-9000 Gent Belgium tel. +32 9 264 33 33 [EMAIL PROTECTED] - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] polar plot with glade
On 4/30/07, Gonzalo A. de la Vega [EMAIL PROTECTED] wrote: Hi all, I'm trying to embed a polar plot into a glade gui. I modified the mpl_with_glade.py example script to have something to start with. No problems with normal plot, but when I try to do polar plot, it fails with the following: Comment out the SpanSelector code -- this is using a matplotlib widget that assumes separable axes, which polar does not have. JDH - 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