Re: [Matplotlib-users] mplot3d: plot_surface() and contour on grid?
Hi Reinier, that looks great! Thanks a lot for all your effort! Kind regards, Matthias On Friday 11 December 2009 00:36:59 Reinier Heeres wrote: > Hi, > > I just committed a patch to do this in svn, also allowing for contour > lines along other directions. > > See the attached image for an example. > > Cheers, > Reinier > > On Thu, Dec 3, 2009 at 10:01 AM, Matthias Michler > > wrote: > > Thanks a lot! > > > > Regards, > > Matthias > > > > On Wednesday 02 December 2009 17:10:54 Reinier Heeres wrote: > >> Hi Matthias, > >> > >> I have a similar patch lying around somewhere, and I will try to apply > >> it soon. I've been terribly busy lately, but I expect some nice > >> mplot3d enhancements in the very near future. > >> > >> Regards, > >> Reinier > >> > >> On Wed, Dec 2, 2009 at 4:22 PM, Matthias Michler > >> > >> wrote: > >> > Hi Andrew, > >> > > >> > do you have any idea if the patch (or a part of it) may get a part of > >> > matplotlib-svn some day? > >> > > >> > Kind regards, > >> > Matthias > >> > > >> > On Friday 09 October 2009 23:25:28 Andrew Straw wrote: > >> >> Matthias Michler wrote: > >> >> > Hello list, > >> >> > > >> >> > I'm not an expert in axes3d, but in case the feature which Nicolas > >> >> > requested is not possible in an easy manner up to now, I propose an > >> >> > additional kwarg for axes3d.Axes3D.contour. Something like > >> >> > *offset*. If offset is None the z-values of the contour lines > >> >> > corresponds to given Z and otherwise offset is used for the > >> >> > z-values of the contour lines. I attached a changed axes3d.py and a > >> >> > patch against current svn. The result is illustrated in the > >> >> > contour3d_demo.png. > >> >> > > >> >> > Could any of the experts have a look at it and tell me if this > >> >> > could be useful, please? > >> >> > > >> >> > Thanks in advance for any comments. > >> >> > > >> >> > Kind regards > >> >> > Matthias > >> >> > > >> >> > On Wednesday 30 September 2009 19:22:42 Nicolas Bigaouette wrote: > >> >> >> Hi, > >> >> >> I have a nice plot_surface() using mplot3d (see attachement). > >> >> >> > >> >> >> I'd like to project the surface on the axis xoy, xoz and yoz with > >> >> >> a contour, similar to this figure: > >> >> >> http://homepages.ulb.ac.be/~dgonze/INFO/matlab/fig19.jpg > >> >> >> > >> >> >> Is it possible using matplotlib and mplot3d? > >> >> >> > >> >> >> Thanx! > >> >> > >> >> Hi Matthias, > >> >> > >> >> I committed your patch to a github branch of MPL, but I'll let > >> >> Reinier actually commit something based on this to MPL. > >> >> http://github.com/astraw/matplotlib/tree/dev/michler-3d-contourf-offs > >> >>ets > >> >> > >> >> -Andrew > > > > - > >- Join us December 9, 2009 for the Red Hat Virtual Experience, > > a free event focused on virtualization and cloud computing. > > Attend in-depth sessions from your desk. Your couch. Anywhere. > > http://p.sf.net/sfu/redhat-sfdev2dev > > ___ > > Matplotlib-users mailing list > > Matplotlib-users@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Return on Information: Google Enterprise Search pays you back Get the facts. http://p.sf.net/sfu/google-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] [matplotlib] can't get any output
Hi, I want to plot data from two different datafiles. To do so I use numpy.loadtxt two times in the script (see below). The problem is, that I don't get any output: no resulting plot, no errormessages or something in the terminal. Even if I comment-out one loadtxt-row nothing happens. Even if I try to plot something simple without using the loaded datafiles, nothing happens. Other files with simple plots without using a datafile work fine. Can't find my mistake. Manuel #!/usr/bin/env python from pylab import * import numpy as np datafile1 = '/path/to/datafile1.dat' datafile2 = '/path/to/datafile2.dat' TIME_F, STIRRER, O2, CO2 = np.loadtxt(datafile1, dtype='float', comments='#', delimiter='\t', usecols=(0,1,2,3), unpack=True) TIME_H, OD, FLUOR, BTM, GLY = np.loadtxt(datafile2, dtype='float', comments='#', delimiter='\t', usecols=(0,1,2,3,4), unpack=True) plot(TIME_F, O2) -- Return on Information: Google Enterprise Search pays you back Get the facts. http://p.sf.net/sfu/google-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] [matplotlib] can't get any output
Hi Manuel, adding a "show()" to your script should resolve the problem. You don't need this using ipython in "-pylab" mode, matplotlibs interactive mode or if you save your figure to some file (savefig), but in your case you need to call the main loop. Kind regards Matthias from the docu: Use show() The user interface backends need to start the GUI mainloop, and this is what show() does. It tells matplotlib to raise all of the figure windows and start the mainloop. Because the mainloop is blocking, you should only call this once per script, at the end. If you are using matplotlib to generate images only and do not want a user interface window, you do not need to call show. On Friday 11 December 2009 10:39:40 Manuel Wittchen wrote: > Hi, > > I want to plot data from two different datafiles. To do so I use > numpy.loadtxt two times in the script (see below). > The problem is, that I don't get any output: no resulting plot, no > errormessages or something in the terminal. > Even if I comment-out one loadtxt-row nothing happens. Even if I try > to plot something simple without using the loaded datafiles, nothing > happens. Other files with simple plots without using a datafile work > fine. > Can't find my mistake. > > Manuel > > #!/usr/bin/env python > from pylab import * > import numpy as np > > datafile1 = '/path/to/datafile1.dat' > datafile2 = '/path/to/datafile2.dat' > > TIME_F, STIRRER, O2, CO2 = np.loadtxt(datafile1, dtype='float', > comments='#', delimiter='\t', usecols=(0,1,2,3), unpack=True) > TIME_H, OD, FLUOR, BTM, GLY = np.loadtxt(datafile2, dtype='float', > comments='#', delimiter='\t', usecols=(0,1,2,3,4), unpack=True) > > plot(TIME_F, O2) -- Return on Information: Google Enterprise Search pays you back Get the facts. http://p.sf.net/sfu/google-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] annotate x-axis
How should I put some text marking a position on the x-axis? -- Return on Information: Google Enterprise Search pays you back Get the facts. http://p.sf.net/sfu/google-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] [matplotlib] change yticks-format
Hi, When I plot very tiny datavalues (biggest value is 8e-7) the yticks are also very small numbers with lots of digits (e.g. 0.02). So the ylabel isn't visible any more. To make the ylabel visible again I would like to change the yticks from 0.02 to 2.0e-6 for example. How do I do that? Regards, Manuel -- Return on Information: Google Enterprise Search pays you back Get the facts. http://p.sf.net/sfu/google-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Anyone going to Fall AGU next week
Hello all, I am new to matplotlib and loving it (No more IDL for me, woohoo). Are any experts attending the meeting that have done things in python/ matplotlib that I need to be sure and see? Still wrapping my mind around the python way instead of the IDL way and talking about cool science and visualizations done can be really useful. I'm in SM11A poster session Monday morning if anyone wants to stop by and say hello. SM11A-1562 Poster Hall (Moscone South) Cheers, Brian -- --- Brian A Larsen, PhD RBSP-ECT Instrument Suite Scientist Boston University Center for Space Physics 725 Commonwealth Ave, Rm 506 Boston, MA 02215-1401 T: 617-358-4945 F: 617-353-6463 balar...@bu.edu -- Return on Information: Google Enterprise Search pays you back Get the facts. http://p.sf.net/sfu/google-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] [matplotlib] change yticks-format
On Fri, Dec 11, 2009 at 11:06 AM, Manuel Wittchen wrote: > Hi, > > When I plot very tiny datavalues (biggest value is 8e-7) the yticks > are also very small numbers with lots of digits (e.g. 0.02). So > the ylabel isn't visible any more. > To make the ylabel visible again I would like to change the yticks > from 0.02 to 2.0e-6 for example. How do I do that? > > Regards, > Manuel > Hi Manuel, This thread should answer your question: http://old.nabble.com/scientific-notation-%5Ctimes-symbol-td26688149.html > > > -- > Return on Information: > Google Enterprise Search pays you back > Get the facts. > http://p.sf.net/sfu/google-dev2dev > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -- Gökhan -- Return on Information: Google Enterprise Search pays you back Get the facts. http://p.sf.net/sfu/google-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] mplot3d: plot_surface() and contour on grid?
Reinier, This in incredible. Wow. Thanks for all of your hard work. Cheers, -paul > -Original Message- > From: Reinier Heeres [mailto:rein...@heeres.eu] > Sent: Thursday, December 10, 2009 3:37 PM > To: Matthias Michler > Cc: matplotlib-users@lists.sourceforge.net > Subject: Re: [Matplotlib-users] mplot3d: plot_surface() and contour on > grid? > > Hi, > > I just committed a patch to do this in svn, also allowing for contour > lines along other directions. > > See the attached image for an example. -- Return on Information: Google Enterprise Search pays you back Get the facts. http://p.sf.net/sfu/google-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Anyone going to Fall AGU next week
On 12/11/2009 12:07 PM, Brian Larsen wrote: > talking about cool > science and visualizations done can be really useful You probably saw the thumbnail gallery, but if not, it is helpful: http://matplotlib.sourceforge.net/gallery.html (Click a chart for its code.) Alan Isaac -- Return on Information: Google Enterprise Search pays you back Get the facts. http://p.sf.net/sfu/google-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] AxesGrid: X axis dates and other axis questions.
(sorry if this is a duplicate post) Jae, Thank you for your help. I found the problem. It was caused by using pyplot.title(). It is working better now. I next have to figure out how to do the following within AxesGrid: 1. How to convert the x axis labels from an integer value representing epoch seconds to a nicely formatted date. I think this has something to do with matplotlib.dates.DateFormatter. I hope that this will remove the 1.25325e9 from the plot. 2. How to minimize or eliminate the white bands on the right and bottom of each axes caused by the axis scale exceeding the data values. 3. How to eliminate (or hide) the first major tic label on the y axis (always 0) so it doesn't overlap with the last tick from the previous y axis. It seems like there may be a different way to approach this than with subplot() Regards, -Ryan * Here's a complete example:* from matplotlib import pyplot from mpl_toolkits.axes_grid import AxesGrid from numpy import arange, linspace, meshgrid, random, transpose # Generate some data x_dim = linspace(125325,125325 + 60*60*24,47) # This is epoch seconds y_dim = arange(0,-2.7,-0.1) z_dim = {} z_dim['chl'] = random.rand(len(x_dim),len(y_dim)) + linspace(5,26,len(y_dim)) z_dim['do'] = random.rand(len(x_dim),len(y_dim)) + linspace(5,10,len(y_dim)) z_dim['turb'] = random.rand(len(x_dim),len(y_dim)) + linspace(4.5,12.5,len(y_dim)) x_grid,y_grid = meshgrid(x_dim,y_dim) x_grid = transpose(x_grid) y_grid = transpose(y_grid) # Start the plotting routines DAP_figure = pyplot.figure(1,(8,8)) #pyplot.title('Title goes here') # *THIS IS THE LINE THAT CAUSES THE EARLIER PROBLEM* pyplot.figtext(0.05,.5,"Depth (m)",rotation='vertical',verticalalignment='center') # Create a grid of axes with the AxesGrid helper class my_grid = AxesGrid(DAP_figure, 111, # Only one grid in DAP_figure nrows_ncols = (3,1), axes_pad = 0.0, #pad between axes in inches aspect=False, #By default (False), widths and heigths of axes in the grid are scaled independently. If True, they are scaled according to their data limits add_all=True, # Add axes to figures if True (default True) share_all=False, # xaxis & yaxis of all axes are shared if True (default False) label_mode = "L", # location of tick labels thaw will be displayed. "1" (only the lower left axes), "L" (left most and bottom most axes), or "all" cbar_location="right", # "right" or "top" cbar_mode="each", # "None","single", or "each" cbar_size="2%", cbar_pad="1%", ) for i,parameter in enumerate(z_dim): ax = my_grid[i].pcolor(x_grid,y_grid,z_dim[parameter]) my_grid[i].set_ylabel(parameter) # Puts a y label on every graph. Eventually we want this labeled only once. my_grid.cbar_axes[i].colorbar(ax) my_grid.cbar_axes[i].axis["right"].toggle(ticklabels=True,label=True) my_grid.cbar_axes[i].set_ylabel("units") my_grid[i].axis["bottom"].major_ticklabels.set_rotation(45) # pyplot.show() [image: p5R5J.png] On Tue, Dec 8, 2009 at 7:39 PM, Jae-Joon Lee wrote: > > Did you test the code in my previous post? > > If you want to get some help, you need to take your time to create a simple > and complete example (which reproduces the problem) that others can easily > test. > > Since I believe the problem is due to the existence of an extra axes, your > example don't need to show any images. Please post a simple script that > draws a blank AxesGrid and shows extra ticklabels as your current code does. > > Regards, > > -JJ > > -- Return on Information: Google Enterprise Search pays you back Get the facts. http://p.sf.net/sfu/google-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] clear
All, In Matlab, if I want to clear my working space of variables, I type: >> clear all How do I do the same thing in Ipython? D. -- Return on Information: Google Enterprise Search pays you back Get the facts. http://p.sf.net/sfu/google-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] clear
David Arnold wrote: > All, > > In Matlab, if I want to clear my working space of variables, I type: > > >> clear all > > How do I do the same thing in Ipython? I think the magic "%reset" is the closest. Eric -- Return on Information: Google Enterprise Search pays you back Get the facts. http://p.sf.net/sfu/google-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] AxesGrid: X axis dates and other axis questions.
On Fri, Dec 11, 2009 at 2:34 PM, Ryan Neve wrote: > Thank you for your help. I found the problem. It was caused by using > pyplot.title(). It is working better now. > I next have to figure out how to do the following within AxesGrid: > >1. How to convert the x axis labels from an integer value representing >epoch seconds to a nicely formatted date. I think this has something to do >with matplotlib.dates.DateFormatter. I hope that this will remove the >1.25325e9 from the plot. > >2. How to minimize or eliminate the white bands on the right and bottom >of each axes caused by the axis scale exceeding the data values. > >3. How to eliminate (or hide) the first major tic label on the y axis >(always 0) so it doesn't overlap with the last tick from the previous y >axis. > > It seems like there may be a different way to approach this than with > subplot() > While there are certain differences, most of the usual matplotlib command supposed to work. So, I recommend you to read the matplotlib documentation first. 1. There are lots of examples in the gallery. Please take a look. 2. see the code below. 3. this kind of thing is difficult to do with axes_grid toolkit. but see below. First, you need to change the x-values to date (not seconds). Then, add the code below inside your for loop. Other than ax.axis["bottom"].. thing, these are just normal matplotlib command. Also, I should have mentioned it earlier, but I don't see any need of axes_grid toolkit in your code. You'd better simply use subplot, which is recommended if you're not familiar with matplotlib. Regards, -JJ ax = my_grid[i] ax.autoscale_view(tight=True) # adjust xlim and ylim # you can manually call ax.set_xlim and ax.set_ylim. ax.xaxis_date() # tick format as date and time ax.axis["bottom"].major_ticklabels.set_rotation(30) ax.axis["bottom"].major_ticklabels.set_ha("right") ax.axis["bottom"].major_ticklabels.set_va("top") # with axes_grid toolkit, it is difficult to make a certain # ticklabel invisible (without disabling the tick line). The # below line of code slightly adjust the ylim so that y=0 ticks # are not shown ax.set_ylim(ymax=-0.001) -- Return on Information: Google Enterprise Search pays you back Get the facts. http://p.sf.net/sfu/google-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users