## Re: [Matplotlib-users] polar plots... again...

 Re: [Matplotlib-users] polar plots... again... From: Greg Whittier - 2004-03-31 02:11:33 ```As a temporary solution you might try just transforming your r,theta data to x, y and then drawing a grid over it. I looked at the classes and with the loglog already done as an example, it shouldn't be too hard to add polar plotting. So far though I haven't got any further than printing out some of the code. Here's a very rough example of a workaround. #!/usr/bin/python from Numeric import * from matplotlib.matlab import * def drawgrid(sp,rticlevels,thetaticlevels): for r in rticlevels: theta = arange(0,2*pi+0.05,0.05) x = r*cos(theta) y = r*sin(theta) sp.plot(x,y,'k-') for theta in thetaticlevels: x = rticlevels[-1]*cos(theta) y = rticlevels[-1]*sin(theta) sp.plot([0,x],[0,y],'k-') def polar(sp,r,theta,marker,rticlevels,thetaticlevels): x = r*cos(theta) y = r*sin(theta) sp.plot(x,y,marker) drawgrid(sp,rticlevels,thetaticlevels) return sp sp = subplot(111) theta = arange(0,pi,0.1) r = 0.5 + cos(theta) polar(sp,r,theta,'b-',arange(0.5,2.0,0.5),arange(0.,2*pi,pi/9.)) On Tue, 2004-03-30 at 14:32, Peter Groszkowski wrote: > Hello: > > I am currently using matplotlib for all the plotting in the software I am writing. I will however need to produce polar plots. As John has mentioned they should be added at one point. So my shameless question is roughly what version could I expect them to be included in? My options are to either wait for it, write it on my own, or write a simple interface (for my code) to GNUPlot or some other tool. I have not done very much poking around in the current matplotlib libraries (other than changing some rather minor details) and have a feeling that this might take me the longest. Interfacing GNUPLot to my code would not take more than a few hours, but I would prefer to stay with matplotlib. > > Thanks for the great work. > Best, ```

 [Matplotlib-users] problem using matplotlib From: marc schellens - 2004-03-30 09:21:52 ```Just installed matplotlib and tried an example from the homepage: Python 2.3.3 (#2, Mar 12 2004, 16:09:39) [GCC 3.2.2 (Mandrake Linux 9.1 3.2.2-3mdk)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>>import matplotlib.matlab Numeric import failed... trying numarray. Traceback (most recent call last): File "", line 1, in ? File "/usr/local/lib/python2.3/site-packages/matplotlib/matlab.py", line 126, in ? from axes import Axes File "/usr/local/lib/python2.3/site-packages/matplotlib/axes.py", line 244, in ? class Axes(Artist): File "/usr/local/lib/python2.3/site-packages/matplotlib/axes.py", line 814, in Axe s def imshow(self, X, cmap = Grayscale(256)): File "/usr/local/lib/python2.3/site-packages/matplotlib/colors.py", line 213, in _ _init__ Colormap.__init__(self, N, 'gray') File "/usr/local/lib/python2.3/site-packages/matplotlib/colors.py", line 96, in __ init__ self._make_red() File "/usr/local/lib/python2.3/site-packages/matplotlib/colors.py", line 118, in _ make_red self.red = 1.0/self.N*arange(self.N, typecode=Float) TypeError: arange() got an unexpected keyword argument 'typecode' Why is this? Any suggestions? thanks, marc _________________________________________________________________ Add photos to your e-mail with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail ```
 [Matplotlib-users] problem using matplotlib From: Marc Schellens - 2004-03-30 09:29:33 ```I just installed the latest matplotlib and wanted to run the first example from the homepage. But I got: Python 2.3.3 (#2, Mar 12 2004, 16:09:39) [GCC 3.2.2 (Mandrake Linux 9.1 3.2.2-3mdk)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import matplotlib.matlab Numeric import failed... trying numarray. Traceback (most recent call last): File "", line 1, in ? File "/usr/local/lib/python2.3/site-packages/matplotlib/matlab.py", line 126, in ? from axes import Axes File "/usr/local/lib/python2.3/site-packages/matplotlib/axes.py", line 244, in ? class Axes(Artist): File "/usr/local/lib/python2.3/site-packages/matplotlib/axes.py", line 814, in Axe s def imshow(self, X, cmap = Grayscale(256)): File "/usr/local/lib/python2.3/site-packages/matplotlib/colors.py", line 213, in _ _init__ Colormap.__init__(self, N, 'gray') File "/usr/local/lib/python2.3/site-packages/matplotlib/colors.py", line 96, in __ init__ self._make_red() File "/usr/local/lib/python2.3/site-packages/matplotlib/colors.py", line 118, in _ make_red self.red = 1.0/self.N*arange(self.N, typecode=Float) TypeError: arange() got an unexpected keyword argument 'typecode' Any suggestions? thanks, marc ```
 Re: [Matplotlib-users] problem using matplotlib From: John Hunter - 2004-03-30 13:49:11 Attachments: text/plain colors.py text/plain
 .matplotlibrc [Was: Re: [Matplotlib-users] problem using matplotlib] From: LUK ShunTim - 2004-03-30 14:12:05 ```John Hunter wrote: >>>>>>"marc" == marc schellens writes: > > > Hi Marc, > > marc> Just installed matplotlib and tried an example from the > > marc> Numeric import failed... trying numarray. > > This is not an error, but it looks like you have numarray installed > but not Numeric, but you haven't set your numerix preference to > numarray. This is a parameter in .matplotlibrc. See > http://matplotlib.sourceforge.net/.matplotlibrc. If indeed you want > to use numarray, I suggests setting > > numerix : numarray > > or else install Numeric. This will stop the numeric/numarray > warnings. > If matplotlib honours the HOME environmental variable, could it not be used on windows system as well? Regards, ST -- ```
 [Matplotlib-users] Re: .matplotlibrc From: John Hunter - 2004-03-30 14:17:20 ```>>>>> "LUK" == LUK ShunTim writes: LUK> If matplotlib honours the HOME environmental variable, could LUK> it not be used on windows system as well? Could you provide the context for your question? What are you trying to do and what isn't working? JDH ```
 Re: [Matplotlib-users] Re: .matplotlibrc From: LUK ShunTim - 2004-03-31 10:18:05 ```John Hunter wrote: >>>>>>"LUK" == LUK ShunTim writes: > > > LUK> If matplotlib honours the HOME environmental variable, could > LUK> it not be used on windows system as well? > > Could you provide the context for your question? What are you trying > to do and what isn't working? > > JDH > Hello John, I'm sorry I was in a hurry to go home and tried to read my mail before that. I did not make myself clear. I just clicked on the link in the message to take a peek at the .matplotlibrc file and found that "On windows, this would be, for example, C:\Python23\share\matplotlib." That led me to wonder whether HOME will take effect in windows installation. I had not updated matplotlib for a while and I know it has seen big improvements. I've now downloaded version 0.52 and I can see now when HOME is set, matplotlib will first read the config file there. Perhaps the comments in the original .matplotlibrc can be altered to make this clear. It's a really a very good idea to be able to set everything using just one config file. I'm sure the people on the list will agree that matplotlib is a great piece of work and you have been wonderful in answering questions. Good day, ST -- ```
 [Matplotlib-users] polar plots... again... From: Peter Groszkowski - 2004-03-30 19:39:44 ```Hello: I am currently using matplotlib for all the plotting in the software I am writing. I will however need to produce polar plots. As John has mentioned they should be added at one point. So my shameless question is roughly what version could I expect them to be included in? My options are to either wait for it, write it on my own, or write a simple interface (for my code) to GNUPlot or some other tool. I have not done very much poking around in the current matplotlib libraries (other than changing some rather minor details) and have a feeling that this might take me the longest. Interfacing GNUPLot to my code would not take more than a few hours, but I would prefer to stay with matplotlib. Thanks for the great work. Best, -- Peter Groszkowski Gemini Observatory Tel: +1 808 974-2509 670 N. A'ohoku Place Fax: +1 808 935-9235 Hilo, Hawai'i 96720, USA ```
 Re: [Matplotlib-users] polar plots... again... From: Greg Whittier - 2004-03-31 02:11:33 ```As a temporary solution you might try just transforming your r,theta data to x, y and then drawing a grid over it. I looked at the classes and with the loglog already done as an example, it shouldn't be too hard to add polar plotting. So far though I haven't got any further than printing out some of the code. Here's a very rough example of a workaround. #!/usr/bin/python from Numeric import * from matplotlib.matlab import * def drawgrid(sp,rticlevels,thetaticlevels): for r in rticlevels: theta = arange(0,2*pi+0.05,0.05) x = r*cos(theta) y = r*sin(theta) sp.plot(x,y,'k-') for theta in thetaticlevels: x = rticlevels[-1]*cos(theta) y = rticlevels[-1]*sin(theta) sp.plot([0,x],[0,y],'k-') def polar(sp,r,theta,marker,rticlevels,thetaticlevels): x = r*cos(theta) y = r*sin(theta) sp.plot(x,y,marker) drawgrid(sp,rticlevels,thetaticlevels) return sp sp = subplot(111) theta = arange(0,pi,0.1) r = 0.5 + cos(theta) polar(sp,r,theta,'b-',arange(0.5,2.0,0.5),arange(0.,2*pi,pi/9.)) On Tue, 2004-03-30 at 14:32, Peter Groszkowski wrote: > Hello: > > I am currently using matplotlib for all the plotting in the software I am writing. I will however need to produce polar plots. As John has mentioned they should be added at one point. So my shameless question is roughly what version could I expect them to be included in? My options are to either wait for it, write it on my own, or write a simple interface (for my code) to GNUPlot or some other tool. I have not done very much poking around in the current matplotlib libraries (other than changing some rather minor details) and have a feeling that this might take me the longest. Interfacing GNUPLot to my code would not take more than a few hours, but I would prefer to stay with matplotlib. > > Thanks for the great work. > Best, ```
 Re: [Matplotlib-users] polar plots... again... From: John Hunter - 2004-03-31 13:16:29 ```>>>>> "Greg" == Greg Whittier writes: Greg> As a temporary solution you might try just transforming your Greg> r,theta data to x, y and then drawing a grid over it. A nice workaround. You may want to add axis('off') To get rid of the background axes. Greg> I looked at the classes and with the loglog already done as Greg> an example, it shouldn't be too hard to add polar plotting. Greg> So far though I haven't got any further than printing out Greg> some of the code. I was planning on taking a different tack, and derive a PolarAxes from Axes and RadialAxis from Axis, etc, which uses circles rather then lines for the radial gridlines, and so on. But you get so close with so little code that your approach may be better. If you want to keep forging ahead, I'm happy to leave the ball in your court. On an unrelated note, from Numeric import * from matplotlib.matlab import * is redundant because matplotlib.matlab imports all of numeric/numarray as well as MLab, fft, and some stuff from LinearAlgebra and Matrix. This is to provide a matlab like environment where most of the things you need are there. JDH ```
 Re: [Matplotlib-users] polar plots... again... From: Greg Whittier - 2004-04-02 10:54:40 ```One thing I'm not sure of is just how polar plots are supposed to work. If you set the axis background color, what gets colored? To get that right (if "in the circle" is right), I guess you'd need a new Axes class. In gnuplot, everything is drawn in the rectangle. "set polar; set grid; plot sin(3*t)" gives you a rectangular grid. You have to do "set grid polar" to circles. Of course gnuplot isn't what we're going for (How do you change background color? The only way I know is using xresources.) I guess the answer should be what matlab does (unless we can think of something better). Now I've never used matlab, so this will take a little research. I borrowed a matlab graphics book and will take a peek. Keep up the good work. Thanks, Greg PS Say hi to hyde park for me. I graduated in 98. On Wed, 2004-03-31 at 07:54, John Hunter wrote: > >>>>> "Greg" == Greg Whittier writes: > > Greg> As a temporary solution you might try just transforming your > Greg> r,theta data to x, y and then drawing a grid over it. > > A nice workaround. You may want to add > > axis('off') > > To get rid of the background axes. > > Greg> I looked at the classes and with the loglog already done as > Greg> an example, it shouldn't be too hard to add polar plotting. > Greg> So far though I haven't got any further than printing out > Greg> some of the code. > > I was planning on taking a different tack, and derive a PolarAxes from > Axes and RadialAxis from Axis, etc, which uses circles rather then > lines for the radial gridlines, and so on. But you get so close with > so little code that your approach may be better. If you want to keep > forging ahead, I'm happy to leave the ball in your court. > > On an unrelated note, > > from Numeric import * > from matplotlib.matlab import * > > is redundant because matplotlib.matlab imports all of numeric/numarray > as well as MLab, fft, and some stuff from LinearAlgebra and Matrix. > This is to provide a matlab like environment where most of the things > you need are there. > > JDH > > > ------------------------------------------------------- > This SF.Net email is sponsored by: IBM Linux Tutorials > Free Linux tutorial presented by Daniel Robbins, President and CEO of > GenToo technologies. Learn everything from fundamentals to system > administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users@... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Greg Whittier ```