[Matplotlib-users] 3d plotting
Hi, I'm using surface_plot to view the results of solving the 2d wave equation. It works fine (code is below) except I would like to add a color bar and fix the limits on the vertical axis. When I add the color bar a new one is added in every iteration instead of overwriting the previous one, anyone know how I can prevent this? Also is it possible to specify a view point when plotting? Thanks D import matplotlib.pyplot as plt import numpy as np import pylab as py from mpl_toolkits.mplot3d import Axes3D from matplotlib import cm pi = np.pi #Set up grid. fig = py.figure() ax = Axes3D(fig) nx = 50 nz = 50 X = np.arange(0, nx, 1) Y = np.arange(0, nz, 1) X, Y = np.meshgrid(X, Y) nsteps = 100 # Constants for equation. c = 4000 dt = 1e-4 h = 1 # Set up source. xs = 0 zs = 0 #fig2 = py.figure() ts = np.arange(dt,nsteps*dt,dt) s = 0.5*np.sin(2*pi*100*ts) #py.plot(ts,s) #py.show() # Homogeneous pressure field. p = np.zeros([nx, nz, nsteps]) # Solve equation. for t in range(0,nsteps-1): for z in range(0,nz-1): for x in range(0,nx-1): p[xs,zs,t] = s[t] k = (c*dt/h)**2 p[x,z,t] = 2*p[x,z,t-1] - p[x,z,t-2] + k*(p[x+1,z,t-1]-4*p[x,z,t-1]+p[x-1,z,t-1]+p[x,z+1,t-1]+p[x,z-1,t-1]) snap = p[:,:,t] surf = ax.plot_surface(X,Y,snap, rstride=1, cstride=1, cmap=cm.jet, linewidth=0) #fig.colorbar(surf, shrink=0.5, aspect=5) #py.draw() py.savefig('/home/davcra/Desktop/plots/2Dwave/'+str(t)) -- This SF email is sponsosred by: Try Windows Azure free for 90 days Click Here http://p.sf.net/sfu/sfd2d-msazure___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] 3D plotting
Hello, I have 2D array where each (x, y) cell represents the height of that point on the Z axis (you can think of it as the map of some mountain chain). I'd like to get the plot_surface() of this data. What I don't understand in particular is the content of the X, Y ,Z array parameter in my particular example. Can anybody elaborate on this please? Thanks! Claudio -- Claudio Martella claudio.marte...@vu.nl -- Systems Optimization Self Assessment Improve efficiency and utilization of IT resources. Drive out cost and improve service delivery. Take 5 minutes to use this Systems Optimization Self Assessment. http://www.accelacomm.com/jaw/sdnl/114/51450054/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] 3d plotting without ticklabels
On Wed, Aug 4, 2010 at 12:11 AM, Benjamin Root wrote: > I have done some further research on this, and it appears to be a bug of > some sort. Possibly the Locators are already made by the time the > ax.set_xticks([]) is called and that function falls on deaf ears because the > real xaxis is actually a different object for Axes3D. When trying to dig > down and force zero ticks from being used (using NullLocator), I get errors > when attempting to draw: I think this is a bug in Axis3D. In the meantime, one can use # make ticklabels and ticklines invisible for a in ax.w_xaxis.get_ticklines()+ax.w_xaxis.get_ticklabels(): a.set_visible(False) Note that w_xaxis, w_yaxis, w_zaxis correspond to x, y, z axis. To remove y tickmakes, replace ax.w_xaxis with ax.w_yaxis. Regards, -JJ -- The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://p.sf.net/sfu/dev2dev-palm ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] 3d plotting without ticklabels
On Mon, Jun 14, 2010 at 2:14 AM, Ola Skavhaug wrote: > On Fri, Jun 11, 2010 at 4:50 PM, Benjamin Root wrote: > > Ola, > > > > Just to make sure, have you tried "ax.set_xticks([])"? > > Yes, I have tried that, but without success. Looks like the tick-logic > is overridden for 3d plotting. Or at least, I cannot figure out how it > works. > > Ola > > > Ben Root > > > > > > > > On Fri, Jun 11, 2010 at 3:05 AM, Ola Skavhaug > wrote: > >> > >> Hi, > >> > >> I'm trying to remove the xtickmarks and ytickmarks from a 3d plot, > >> without any success. > >> > >> The example I experiment with is the following: > >> > >> from mpl_toolkits.mplot3d import axes3d > >> import matplotlib.pyplot as plt > >> > >> fig = plt.figure() > >> ax = axes3d.Axes3D(fig) > >> X, Y, Z = axes3d.get_test_data(0.05) > >> cset = ax.contour(X, Y, Z, 16, extend3d=True) > >> ax.clabel(cset, fontsize=9, inline=1) > >> > >> #One try that didn't work > >> ax.set_xticklabels("") > >> > >> plt.show() > >> > >> It looks like the final plot ignores all my efforts in turning the > >> ticks off. Any help on this matter would be greatly appreciated. > >> > >> Regards, > >> -- > >> Ola Skavhaug > >> Research Programmer > >> Simula Research Laboratory > >> > >> > I have done some further research on this, and it appears to be a bug of some sort. Possibly the Locators are already made by the time the ax.set_xticks([]) is called and that function falls on deaf ears because the real xaxis is actually a different object for Axes3D. When trying to dig down and force zero ticks from being used (using NullLocator), I get errors when attempting to draw: Traceback (most recent call last): File "/home/bvr/Programs/matplotlib/matplotlib/lib/matplotlib/backends/backend_gtk.py", line 390, in expose_event self._render_figure(self._pixmap, w, h) File "/home/bvr/Programs/matplotlib/matplotlib/lib/matplotlib/backends/backend_gtkagg.py", line 75, in _render_figure FigureCanvasAgg.draw(self) File "/home/bvr/Programs/matplotlib/matplotlib/lib/matplotlib/backends/backend_agg.py", line 394, in draw self.figure.draw(self.renderer) File "/home/bvr/Programs/matplotlib/matplotlib/lib/matplotlib/artist.py", line 55, in draw_wrapper draw(artist, renderer, *args, **kwargs) File "/home/bvr/Programs/matplotlib/matplotlib/lib/matplotlib/figure.py", line 798, in draw func(*args) File "/home/bvr/Programs/matplotlib/matplotlib/lib/mpl_toolkits/mplot3d/axes3d.py", line 172, in draw ax.draw(renderer) File "/home/bvr/Programs/matplotlib/matplotlib/lib/mpl_toolkits/mplot3d/axis3d.py", line 231, in draw newval = get_flip_min_max(xyz1[0], newindex, mins, maxs) IndexError: list index out of range Ben Root -- The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://p.sf.net/sfu/dev2dev-palm___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] 3d plotting without ticklabels
Bump. Is this possible using mplot3d?? I would, also like to turn off the ticks and the tick labels. skavhaug wrote: > > On Fri, Jun 11, 2010 at 4:50 PM, Benjamin Root wrote: >> Ola, >> >> Just to make sure, have you tried "ax.set_xticks([])"? > > Yes, I have tried that, but without success. Looks like the tick-logic > is overridden for 3d plotting. Or at least, I cannot figure out how it > works. > > Ola > >> Ben Root >> >> >> >> On Fri, Jun 11, 2010 at 3:05 AM, Ola Skavhaug wrote: >>> >>> Hi, >>> >>> I'm trying to remove the xtickmarks and ytickmarks from a 3d plot, >>> without any success. >>> >>> The example I experiment with is the following: >>> >>> from mpl_toolkits.mplot3d import axes3d >>> import matplotlib.pyplot as plt >>> >>> fig = plt.figure() >>> ax = axes3d.Axes3D(fig) >>> X, Y, Z = axes3d.get_test_data(0.05) >>> cset = ax.contour(X, Y, Z, 16, extend3d=True) >>> ax.clabel(cset, fontsize=9, inline=1) >>> >>> #One try that didn't work >>> ax.set_xticklabels("") >>> >>> plt.show() >>> >>> It looks like the final plot ignores all my efforts in turning the >>> ticks off. Any help on this matter would be greatly appreciated. >>> >>> Regards, >>> -- >>> Ola Skavhaug >>> Research Programmer >>> Simula Research Laboratory >>> >>> >>> -- >>> ThinkGeek and WIRED's GeekDad team up for the Ultimate >>> GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the >>> lucky parental unit. See the prize list and enter to win: >>> http://p.sf.net/sfu/thinkgeek-promo >>> ___ >>> Matplotlib-users mailing list >>> Matplotlib-users@lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> >> > > > > -- > Ola Skavhaug > Research Programmer > Simula Research Laboratory > > -- > ThinkGeek and WIRED's GeekDad team up for the Ultimate > GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the > lucky parental unit. See the prize list and enter to win: > http://p.sf.net/sfu/thinkgeek-promo > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- View this message in context: http://old.nabble.com/3d-plotting-without-ticklabels-tp28852287p29311338.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://p.sf.net/sfu/dev2dev-palm ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] 3d plotting without ticklabels
On Fri, Jun 11, 2010 at 4:50 PM, Benjamin Root wrote: > Ola, > > Just to make sure, have you tried "ax.set_xticks([])"? Yes, I have tried that, but without success. Looks like the tick-logic is overridden for 3d plotting. Or at least, I cannot figure out how it works. Ola > Ben Root > > > > On Fri, Jun 11, 2010 at 3:05 AM, Ola Skavhaug wrote: >> >> Hi, >> >> I'm trying to remove the xtickmarks and ytickmarks from a 3d plot, >> without any success. >> >> The example I experiment with is the following: >> >> from mpl_toolkits.mplot3d import axes3d >> import matplotlib.pyplot as plt >> >> fig = plt.figure() >> ax = axes3d.Axes3D(fig) >> X, Y, Z = axes3d.get_test_data(0.05) >> cset = ax.contour(X, Y, Z, 16, extend3d=True) >> ax.clabel(cset, fontsize=9, inline=1) >> >> #One try that didn't work >> ax.set_xticklabels("") >> >> plt.show() >> >> It looks like the final plot ignores all my efforts in turning the >> ticks off. Any help on this matter would be greatly appreciated. >> >> Regards, >> -- >> Ola Skavhaug >> Research Programmer >> Simula Research Laboratory >> >> >> -- >> ThinkGeek and WIRED's GeekDad team up for the Ultimate >> GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the >> lucky parental unit. See the prize list and enter to win: >> http://p.sf.net/sfu/thinkgeek-promo >> ___ >> Matplotlib-users mailing list >> Matplotlib-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- Ola Skavhaug Research Programmer Simula Research Laboratory -- ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] 3d plotting without ticklabels
Ola, Just to make sure, have you tried "ax.set_xticks([])"? Ben Root On Fri, Jun 11, 2010 at 3:05 AM, Ola Skavhaug wrote: > Hi, > > I'm trying to remove the xtickmarks and ytickmarks from a 3d plot, > without any success. > > The example I experiment with is the following: > > from mpl_toolkits.mplot3d import axes3d > import matplotlib.pyplot as plt > > fig = plt.figure() > ax = axes3d.Axes3D(fig) > X, Y, Z = axes3d.get_test_data(0.05) > cset = ax.contour(X, Y, Z, 16, extend3d=True) > ax.clabel(cset, fontsize=9, inline=1) > > #One try that didn't work > ax.set_xticklabels("") > > plt.show() > > It looks like the final plot ignores all my efforts in turning the > ticks off. Any help on this matter would be greatly appreciated. > > Regards, > -- > Ola Skavhaug > Research Programmer > Simula Research Laboratory > > > -- > ThinkGeek and WIRED's GeekDad team up for the Ultimate > GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the > lucky parental unit. See the prize list and enter to win: > http://p.sf.net/sfu/thinkgeek-promo > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -- ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] 3d plotting without ticklabels
Hi, I'm trying to remove the xtickmarks and ytickmarks from a 3d plot, without any success. The example I experiment with is the following: from mpl_toolkits.mplot3d import axes3d import matplotlib.pyplot as plt fig = plt.figure() ax = axes3d.Axes3D(fig) X, Y, Z = axes3d.get_test_data(0.05) cset = ax.contour(X, Y, Z, 16, extend3d=True) ax.clabel(cset, fontsize=9, inline=1) #One try that didn't work ax.set_xticklabels("") plt.show() It looks like the final plot ignores all my efforts in turning the ticks off. Any help on this matter would be greatly appreciated. Regards, -- Ola Skavhaug Research Programmer Simula Research Laboratory -- ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] 3D plotting support
You might take a look at tvtk.mlab and mavayi. http://www.scipy.org/Cookbook/MayaVi On 8/14/07, Eric Firing <[EMAIL PROTECTED]> wrote: > Kaushik Ghose wrote: > > Hi Everyone, > > > > I vaguely remember a comment from a poster a short while back that > > suggested that 3D support in matplotlib was not serious. I would like to > > ask what plans there are for 3D plotting support in this great library. > > There are no plans. The topic keeps coming up, but no one has come > forward to put steady work into it. It is not entirely clear how much > can be done using the present approach, which is a layer on top of a > fundamentally 2D framework. > > Eric > > > > thanks! > > -Kaushik > > > - > 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
Re: [Matplotlib-users] 3D plotting support
Kaushik Ghose wrote: > Hi Everyone, > > I vaguely remember a comment from a poster a short while back that > suggested that 3D support in matplotlib was not serious. I would like to > ask what plans there are for 3D plotting support in this great library. There are no plans. The topic keeps coming up, but no one has come forward to put steady work into it. It is not entirely clear how much can be done using the present approach, which is a layer on top of a fundamentally 2D framework. Eric > > thanks! > -Kaushik - 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] 3D plotting support
Hi Everyone, I vaguely remember a comment from a poster a short while back that suggested that 3D support in matplotlib was not serious. I would like to ask what plans there are for 3D plotting support in this great library. thanks! -Kaushik - 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
Re: [Matplotlib-users] 3D plotting?
3D plotting in mpl is unmaintained, so I don't recommend relying on it unless you can bring it up to date and maintain it. After committing a bugfix to svn, the following works with svn mpl and does something like what you want (but might not work with whatever version of mpl you are using.) -- from pylab import * from matplotlib import axes3d N = 30 x = 0.9*rand(N) y = 0.9*rand(N) z = rand(N) c = rand(N) area = pi*(10 * rand(N))**2 # 0 to 10 point radiuses fig = gcf() ax3d = axes3d.Axes3D(fig) plt = fig.axes.append(ax3d) ax3d.scatter(x,y,z,s=area, marker='^', c=c) show() - A more general problem is that a 3D scatter plot is ambiguous--how do you know where a point really is in 3D? You would have to do something like mapping color to Z. Is that what you want to do? Eric william ratcliff wrote: > Is there a way to choose the color map for doing scatter plots using > Axes3D? In the test_scatter() example in the class, there is a line > something like: > > ax.scatter3D(xs,ys,zs, c='r') > > I would like to plot points based on 3 dimensional coordinates specified > by xs,ys, zs, which works great. However, I would like to color the > points with a third array, for example, cs which would either specify an > index in a color map, or even just an intensity of a given color. Is > this possible within matplotlib? > > Thanks, > William > > > > > - > 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
Re: [Matplotlib-users] 3D plotting?
2007/8/10, william ratcliff <[EMAIL PROTECTED]>: > > so it would be something like: > > > c=numpy.array([[1,2,3],[0,0,4],[0,2,4]]), where the values in the array go > from 0-255 and denote r,g,b values? > > Thanks! I use floatting point values, don't know if integers work. I thing that colormap could be used, but I really don't know, I do not use them. Matthieu - 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] 3D plotting?
Is there a way to choose the color map for doing scatter plots using Axes3D? In the test_scatter() example in the class, there is a line something like: ax.scatter3D(xs,ys,zs, c='r') I would like to plot points based on 3 dimensional coordinates specified by xs,ys, zs, which works great. However, I would like to color the points with a third array, for example, cs which would either specify an index in a color map, or even just an intensity of a given color. Is this possible within matplotlib? Thanks, William - 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
Re: [Matplotlib-users] 3D plotting lines / markers / colors question
Hi, In fact, polt3D and plot3d are the same, IIRC. the kwargs are exactly the same as plot or scatter, as those methods are called inside plot3d ans scatter3d to make the plot. You can use 'ro-', no sweat, it works like a charm - at least for me :) - Matthieu 2007/4/12, belinda thom <[EMAIL PROTECTED]>: On Apr 11, 2007, at 4:54 PM, belinda thom wrote: > Hi, > > What kwargs are available for plot3D and scatter3D? And what is the difference between plot3d and plot3D? The former seems most "matlab" like, and was what I was looking for: a way to plot individual points and/or curves in 3d using matlab- style line formatting info like: 'ro-' or 'go--' I'm posting this discovery here b/c it took me a long time to find (from the cookbook I somehow started using plot3D and didn't realize there was a plot3d). I am still unsure what args you can pass into plot3D and scatter3D to achieve similar line control. If there's a high-level place this stuff is described, it would be beneficial. - 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 [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/matplotlib-users - 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 [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] 3d plotting question
> Hi Belinda, > > I've been playing with 3D plots and scatter plots in the past few days > and I've been able to get them working. You should be able to pass in > a c= parameter as you would for a normal 2d scatter plot. I've > been doing this and it's working for me. Interesting. I'm on Mac OS X 4.8.9, running Python 2.4.4, using Matplotlib 0.87.7 w/TkAgg (I might be using Wx, but would have to get a problem w/my machine's and all the students' lab machines wx libraries updated). When I try using the c='r' parameter, I run into problems. I also tried c='red'. One big problem for me is that which kwargs can be used where and what values they can take on is not well documented. For instance, in plot3d (as opposed to plot3D) you can pass the typical Matplotlib 'r.-' string and it just works. But in plot_wireframe, for example, it appears you must use different kwargs (for instance, linestyle='solid' and color=''). I am not sure about these notions, b/c I've had to deduce them from the code and various google-based snippets. That's why I'm asking for more guidance about the various kwarg usages. Is there any good place to find more cohesive info online? The most useful place I could find seemed to be in matplotlib's collections.py, an __init__ function's documentation (that's where I deduced, for instance, the linestyle and RGB color info). If there isn't such a place, someone should probably modify the matplotlib 3d cookbook. I'd be willing to do that but I'd first need to have a better understanding about the various functions' kwargs :-). I'll append a case I used to generate an error, as well as the error reporting below. I'm also not quite sure how to use the errors that are reported to help me track down where the problems might be, so if anyone has some advice on that, it might help me better help myself in the future. As always, thx, --b Example Code: - import copy import pylab as P import matplotlib.axes3d as P3 def test() : [X,Y] = P.meshgrid(P.linspace(-3,3,7),P.linspace(-3,3,7)) Z = copy.deepcopy(X) Z1 = copy.deepcopy(X) for i in xrange(len(X)) : for j in xrange(len(X[0])) : Z[i][j] = X[i][j]*Y[i][j] Z1[i][j] = X[i][j]*Y[i][j] - 5 P.close('all') fig = P.figure() ax = P3.Axes3D(fig) ax.Plot3D(ravel(X),ravel(Y),ravel(Z),c='r') In [213]: T.test() --- exceptions.AttributeErrorTraceback (most recent call last) /Users/bthom/belinda/mills/aicourse/material/week12/lec/examples/ /Users/bthom/belinda/mills/aicourse/material/week12/lec/examples/ threeDa.py in test() 11 Z1[i][j] = X[i][j]*Y[i][j] - 5 12 P.close('all') 13 fig = P.figure() 14 ax = P3.Axes3D(fig) ---> 15 ax.Plot3D(ravel(X),ravel(Y),ravel(Z),c='red') /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site- packages/matplotlib/axes3d.py in __getattr__(self, k) 660 661 def __getattr__(self, k): --> 662 return getattr(self.wrapped,k) 663 664 def __setattr__(self, k,v): AttributeError: Axes3DI instance has no attribute 'Plot3D' > /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/ site-packages/matplotlib/axes3d.py(662)__getattr__() 661 def __getattr__(self, k): --> 662 return getattr(self.wrapped,k) 663 ipdb> - 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 [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] 3d plotting question
Thanks for the input. Its easy for me to patch my own machine, but for students in my class who are using lab machines, its more difficult. Hopefully I can get someone to upgrade the machines in the lab I'm using. (Its difficult to get facilities people to agree to update coursework installs mid- semester). Morale of my story: don't expect 3d plotting to necessarily work / be easy if you don't carefully test it first :-(. I too would be interested in robustifying / making more accessible the 3d stuff, but will have to wait until after the class I'm teaching ends. --b On Apr 11, 2007, at 6:57 PM, Tim Leslie wrote: > Even in the lastest svn version these test methods are all broken to a > greater or lesser degree (as I found out a couple of days ago). If I > find time over the weekend I'll try to fix them up. In the mean time, > if you change them to look something like > > fig = pylab.figure() > ax = Axes3d(fig) > ... etc > > it should get you one step closer to having them working. I'll post > back here if/when I manage to get them cleaned up. > > Cheers, > > Tim > - 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 [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] 3D plotting lines / markers / colors question
On Apr 11, 2007, at 4:54 PM, belinda thom wrote: > Hi, > > What kwargs are available for plot3D and scatter3D? And what is the difference between plot3d and plot3D? The former seems most "matlab" like, and was what I was looking for: a way to plot individual points and/or curves in 3d using matlab- style line formatting info like: 'ro-' or 'go--' I'm posting this discovery here b/c it took me a long time to find (from the cookbook I somehow started using plot3D and didn't realize there was a plot3d). I am still unsure what args you can pass into plot3D and scatter3D to achieve similar line control. If there's a high-level place this stuff is described, it would be beneficial. - 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] 3D plotting lines / markers / colors question
Hi, What kwargs are available for plot3D and scatter3D? Thanks, --b - 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] 3d plotting question
I also seem to have some other 3D plotting problems. Again, following some of the demo/test advice in the cookbook, I tried things like import pylab as p import matplotlib.axes3d as P3 P3.test_surface() and get errors (seems Axes3D needs a figure, no?). I'm using matplotlib version 0.87.7. Any ideas? Thx, --b In [49]: P3.test_surface() --- exceptions.TypeError Traceback (most recent call last) /Users/bthom/belinda/mills/aicourse/material/week12/lec/examples/ /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site- packages/matplotlib/axes3d.py in test_surface() 739 740 def test_surface(): --> 741 ax = Axes3D() 742 743 X,Y,Z = get_test_data(0.05) TypeError: __init__() takes at least 2 arguments (1 given) > /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/ site-packages/matplotlib/axes3d.py(741)test_surface() 740 def test_surface(): --> 741 ax = Axes3D() 742 ipdb> In [50]: P3.test_surface? Type: function Base Class: String Form: Namespace: Interactive File: /Library/Frameworks/Python.framework/Versions/2.4/lib/ python2.4/site-packages/matplotlib/axes3d.py Definition: P3.test_surface() Docstring: In [51]: P3.test_surface() --- exceptions.TypeError Traceback (most recent call last) /Users/bthom/belinda/mills/aicourse/material/week12/lec/examples/ /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site- packages/matplotlib/axes3d.py in test_surface() 739 740 def test_surface(): --> 741 ax = Axes3D() 742 743 X,Y,Z = get_test_data(0.05) TypeError: __init__() takes at least 2 arguments (1 given) > /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/ site-packages/matplotlib/axes3d.py(741)test_surface() 740 def test_surface(): --> 741 ax = Axes3D() 742 ipdb> In [52]: P3.test_contour() --- exceptions.TypeError Traceback (most recent call last) /Users/bthom/belinda/mills/aicourse/material/week12/lec/examples/ /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site- packages/matplotlib/axes3d.py in test_contour() 750 751 def test_contour(): --> 752 ax = Axes3D() 753 754 X,Y,Z = get_test_data(0.05) TypeError: __init__() takes at least 2 arguments (1 given) > /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/ site-packages/matplotlib/axes3d.py(752)test_contour() 751 def test_contour(): --> 752 ax = Axes3D() 753 ipdb> - 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] 3d plotting question
Hi, I'm having problems plotting two different kind of graphs on the same 3D figure. Was hoping for some pointers. Here's some basic test code, to demonstrate what I'd like to be able to do. import copy import pylab as P import matplotlib.axes3d as P3 def test() : [X,Y] = P.meshgrid(P.linspace(-3,3,7),P.linspace(-3,3,7)) Z = copy.deepcopy(X) Z1 = copy.deepcopy(X) for i in xrange(len(X)) : for j in xrange(len(X[0])) : Z[i][j] = X[i][j]*Y[i][j] Z1[i][j] = X[i][j]*Y[i][j] - 5 P.close('all') fig = P.figure() ax = P3.Axes3D(fig) ax.scatter3D(P.ravel(X),P.ravel(Y),P.ravel(Z)) ax.set_xlabel('x') ax.set_ylabel('y') ax.set_zlabel('z=x*y') P.show() ax.plot3D(P.ravel(X),P.ravel(Y),P.ravel(Z1)) P.show() Which produces an autoscale_view kwarg error appended below. I've tried calling plot3D with scalex=False and scaleY=False but that doesn't fix the problem. I've also tried creating a new axis (e.g. ax1) and doing ax1.Plot3D to no avail. It seems to be an error w/in matplotlib, but perhaps I'm misusing something. I haven't been able to find much documentation for this at http://www.scipy.org/Cookbook/ Matplotlib/mplot3D so have resorted to playing around. If anyone also knows how to pass color-marker info into scatter3D, I have been able to create two of those on the same figure, so being able to change the colors of each and just using scatter3D would be a reasonable hack for my situation. Advice always appreciated, --b In [25]: T.test() --- exceptions.TypeError Traceback (most recent call last) /Users/bthom/belinda/mills/aicourse/material/week12/lec/examples/ /Users/bthom/belinda/mills/aicourse/material/week12/lec/examples/ threeD.py in test() 18 ax.set_zlabel('z=x*y') 19 P.show() ---> 20 ax.plot3D(P.ravel(X),P.ravel(Y),P.ravel(Z1)) 21 P.show() 22 /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site- packages/matplotlib/axes3d.py in plot3D(self, xs, ys, zs, *args, **kwargs) 488 def plot3D(self, xs, ys, zs, *args, **kwargs): 489 had_data = self.has_data() --> 490 lines = Axes.plot(self, xs,ys, *args, **kwargs) 491 if len(lines)==1: 492 line = lines[0] /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site- packages/matplotlib/axes.py in plot(self, *args, **kwargs) 2129 lines = [line for line in lines] # consume the generator 2130 -> 2131 self.autoscale_view(scalex=scalex, scaley=scaley) 2132 return lines 2133 TypeError: autoscale_view() got an unexpected keyword argument 'scalex' > /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/ site-packages/matplotlib/axes.py(2131)plot() 2130 -> 2131 self.autoscale_view(scalex=scalex, scaley=scaley) 2132 return lines - 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] 3d Plotting
> The colors come from the current colormap. You can go all out and > make your own colormap and color based on index using your map. I > don't know how to do that off the top of my head though. The colors may come from the colormap, but how do they get assigned to areas of the plot itself? The most obvious way to do it is to index by z, so areas with low z are shown with a cool color, and areas with high z are shown with a hot color (assuming you are using a cold-hot colormap). As far as I can tell though, this is not the system currently used, nor is there any coherent system used. - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] 3d Plotting
The colors come from the current colormap. You can go all out and make your own colormap and color based on index using your map. I don't know how to do that off the top of my head though. On 8/21/06, rich kowalczyk <[EMAIL PROTECTED]> wrote: > I understand that 3D plotting is not fully working yet, but I have a > question that might be answerable anyway. > > I can get a nice looking 3D plot of my data using > > surf = ax3d.plot_surface(x, y, z) > > but I can't control the colors used in the plot. I can do a > > surf.set_array(ColorArray) > > and the contents of the array (ColorArray) will be translated into > colors on the plot somehow, but the translation appears to be > arbitrary. Does anyone know how the translation is done, so that I > can assign a certain color to a certain part of the plot? > > Thanks, > Rich. > > - > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] 3d Plotting
I understand that 3D plotting is not fully working yet, but I have a question that might be answerable anyway. I can get a nice looking 3D plot of my data using surf = ax3d.plot_surface(x, y, z) but I can't control the colors used in the plot. I can do a surf.set_array(ColorArray) and the contents of the array (ColorArray) will be translated into colors on the plot somehow, but the translation appears to be arbitrary. Does anyone know how the translation is done, so that I can assign a certain color to a certain part of the plot? Thanks, Rich. - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users