Re: [Matplotlib-users] 3d plotting without ticklabels
On Fri, Jun 11, 2010 at 4:50 PM, Benjamin Root ben.r...@ou.edu 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 skavh...@simula.no 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] which interpolation type is used by contour() ?
Hi Everyone, I'd like to know, what is the underline mechanism that connects the points of my gridded data when I use contour(). Can I control this mechanism ? Maybe I missed it in the documentation, but it's not clear to me. Thanks in advance, I think it's the same than this used in the imshow method. Would you like to check ? greetings. -- 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] which interpolation type is used by contour() ?
On 06/13/2010 10:27 PM, David Kremer wrote: Hi Everyone, I'd like to know, what is the underline mechanism that connects the points of my gridded data when I use contour(). Can I control this mechanism ? No. If you want smoother contours you can either use a 2-D interpolation method to map your data to a finer grid and then use that for contouring, or you can use a spline algorithm to smooth the contour paths directly. There are more problems and pitfalls with the second method than with the first, so don't bother trying it. Maybe I missed it in the documentation, but it's not clear to me. Thanks in advance, I think it's the same than this used in the imshow method. Would you like to check ? No, image display and contouring use completely different algorithms. Imshow uses any of several 2-D interpolation methods to map values given on one square grid onto another square grid. It does not create paths; it simply displays pixels. In contouring, linear interpolation is used to find the intersections between contour level lines and grid lines; the intersection points are connected by line segments; and the line segments are assembled into complete contour paths, which are then drawn (contour) or filled (contourf). Eric greetings. -- 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
Re: [Matplotlib-users] which interpolation type is used by contour() ?
Hi Eric, Thanks for your reply. I've already suspected that it's a simple linear interpolation like in matlab. And for better interpolation I should use griddata on a finer grid. That's all clear now ! -- Oz Nahum Graduate Student Zentrum für Angewandte Geologie Universität Tübingen --- Imagine there's no countries it isn't hard to do Nothing to kill or die for And no religion too Imagine all the people Living life in peace -- 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] displaying multiple images in series
Hi matplotlib users, I'm trying to write a script to loop through a bunch of tiff files, display each image, and choose to accept or reject each image. Something like: for f in files: im = imread(f) imshow(im) # Accept keyboard input to accept or reject image # Close the image The problem is that I can't figure out how to show multiple images in series. I can't use matplotlib.pyplot.show() because that can only be used once at the very end of a script, and I don't want to show all the images at once. matplotlib.pyplot.draw() seemed like a promising candidate, but it only seems to work if I've already used show() once in the script. It seems like there should be a simple way to do this, but I can't quite seem to find it. Thanks, Daniel -- 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] color in plot3d
First what version of mpl are you using? if it is recent this colour word already exists, I asked about this a couple months ago and i should point you first to the example in the svn it does a checkerboard, but i cannot remember the exact name. Although i know it plots a checkerboard effect on one of the example plots. The way that color keyword is set up, it is dedsigned to take a color word or rgba tuple , (Reinier will know this better than me), however if you want to just assign colors based on a colour map you can take you color array and reshape the same way the plot surface command does then use surf.set_array() here is a snippet of the code I use to do this I am pretty sure it won’t run the way it is right now but the idea is buried in there note that regmap xyz and costmapz are all the same size and are nxm matrices costmapout is a 2x(m.n) if i can do the math correctly from mpl_toolkits.mplot3d import Axes3D from matplotlib import cm import numpy as np #-- ax = Axes3D(fig) scale= 3 surf = ax.plot_surface(regMAPx ,regMAPy,-regMAPz , rstride=scale,cstride=scale, cmap=cm.jet, linewidth=.250 ) # to reshape the cost map to match grid used in plot surf rows, cols = costMAPz.shape costmapout = [] for rs in np.arange(0, rows-1, scale): for cs in np.arange(0, cols-1, scale): costmapout.append(costMAPz[rs][cs]) costmapout=np.array(costmapout) surf.set_array(costmapout) ## do your show plot stuff here!! Mike Alger From: Pablo Angulo [mailto:pablo.ang...@uam.es] Sent: June-11-10 7:04 AM To: matplotlib-users@lists.sourceforge.net Subject: [Matplotlib-users] color in plot3d Hello! I wonder if there is a way to make 3d plots specifying arbitrary colors, instead of having the color be a function of the height. I was able to achieve this making minimal changes to the plot_surface method of Axes3D, adding as an optional keyword argument a function cfun which specifies the color (it specifies a real number that is mapped into a color by the color map cmap). But is there a standard way? Regard Pablo Angulo from matplotlib.colors import Normalize, colorConverter def plot_surface(self, X, Y, Z, *args, **kwargs): ''' Create a surface plot. By default it will be colored in shades of a solid color, but it also supports color mapping by supplying the *cmap* argument. == ArgumentDescription == *X*, *Y*, Data values as numpy.arrays *Z* *rstride* Array row stride (step size) *cstride* Array column stride (step size) *color* Color of the surface patches *cmap* A colormap for the surface patches. *cfun* The function giving the color == ''' had_data = self.has_data() rows, cols = Z.shape tX, tY, tZ = np.transpose(X), np.transpose(Y), np.transpose(Z) rstride = kwargs.pop('rstride', 10) cstride = kwargs.pop('cstride', 10) color = kwargs.pop('color', 'b') color = np.array(colorConverter.to_rgba(color)) cmap = kwargs.get('cmap', None) cfun = kwargs.pop('cfun', None) polys = [] normals = [] avgz = [] if not cfun: cfun = lambda p:p[2] for rs in np.arange(0, rows-1, rstride): for cs in np.arange(0, cols-1, cstride): ps = [] corners = [] for a, ta in [(X, tX), (Y, tY), (Z, tZ)]: ztop = a[rs][cs:min(cols, cs+cstride+1)] zleft = ta[min(cols-1, cs+cstride)][rs:min(rows, rs+rstride+1)] zbase = a[min(rows-1, rs+rstride)][cs:min(cols, cs+cstride+1):] zbase = zbase[::-1] zright = ta[cs][rs:min(rows, rs+rstride+1):] zright = zright[::-1] corners.append([ztop[0], ztop[-1], zbase[0], zbase[-1]]) z = np.concatenate((ztop, zleft, zbase, zright)) ps.append(z) # The construction leaves the array with duplicate points, which # are removed here. ps = zip(*ps) lastp = np.array([]) ps2 = [] avgzsum = 0.0 for p in ps: if p != lastp: ps2.append(p) lastp = p avgzsum += cfun(p) polys.append(ps2) avgz.append(avgzsum / len(ps2)) v1 = np.array(ps2[0]) - np.array(ps2[1]) v2 = np.array(ps2[2]) - np.array(ps2[0]) normals.append(np.cross(v1, v2)) polyc = art3d.Poly3DCollection(polys, *args, **kwargs) if cmap is not None: polyc.set_array(np.array(avgz)) polyc.set_linewidth(0)