Re: [Matplotlib-users] Can I change pixel aspect with axes_grid
On 08/19/2011 07:43 PM, gru...@bigpond.net.au wrote: Usually imshow(arr, aspect='auto') or imshow(arr, aspect=2.0) will display the image with pixels having some aspect ratio other than 1:1 However, I cannot get this to work when using imshow within an AxesGrid axis. Is there a way to get an array shown with imshow() within an AxesGrid axis to have a pixel aspect other than 1:1 ? If not, is there a simple way to add a shared colorbar when using subplots() ? By shared colorbar, do you mean something like this? http://matplotlib.sourceforge.net/examples/pylab_examples/multi_image.html It is using ordinary axes, and is a bit more complex than needed for many purposes. Eric Gary -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Can I change pixel aspect with axes_grid
If you want aspect=auto, this must also be set when you create ImageGrid. A simple example is attached. If you want a fixed aspect other than 1, it is doable but gets a bit tricky. Let me know if this is what you want. Regards, -JJ from mpl_toolkits.axes_grid1 import ImageGrid fig = plt.figure(1) grid = ImageGrid(fig, 111, (2, 1), aspect=False, label_mode='L', cbar_mode=single, ) arr = np.arange(100).reshape((10, 10)) im1 = grid[0].imshow(arr, aspect=auto) im2 = grid[1].imshow(arr, aspect=auto) grid[0].cax.colorbar(im1) On Sat, Aug 20, 2011 at 2:43 PM, gru...@bigpond.net.au gru...@bigpond.net.au wrote: Usually imshow(arr, aspect='auto') or imshow(arr, aspect=2.0) will display the image with pixels having some aspect ratio other than 1:1 However, I cannot get this to work when using imshow within an AxesGrid axis. Is there a way to get an array shown with imshow() within an AxesGrid axis to have a pixel aspect other than 1:1 ? If not, is there a simple way to add a shared colorbar when using subplots() ? Gary -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Can I change pixel aspect with axes_grid
Thanks Eric and JJ, Both of your answers are solutions to my problem actually. I spent a while trying to figure this out and didn't get anywhere. This was an exercise in frustration with matplotlib's documentation. Thankfully this list and its members are here to save us. I assumed it was just a simple flag or option I had missed and this turned out to be the case. I had even tried setting aspect=False when creating my AxesGrid object and setting aspect=auto, but because I was poking around in the dark, I must not have set both at the same time. I also thought I'd seen an example of this somewhere, which is what Eric pointed out, but even thinking I'd seen it, I couldn't find it again. I had looked in the gallery but missed the example - looking back at the gallery now, I think it might be because every other related example uses the jet colour scheme and it simply didn't register. regards, Gary On Sat, Aug 20, 2011 at 6:49 PM, Jae-Joon Lee lee.j.j...@gmail.com wrote: If you want aspect=auto, this must also be set when you create ImageGrid. A simple example is attached. If you want a fixed aspect other than 1, it is doable but gets a bit tricky. Let me know if this is what you want. Regards, -JJ from mpl_toolkits.axes_grid1 import ImageGrid fig = plt.figure(1) grid = ImageGrid(fig, 111, (2, 1), aspect=False, label_mode='L', cbar_mode=single, ) arr = np.arange(100).reshape((10, 10)) im1 = grid[0].imshow(arr, aspect=auto) im2 = grid[1].imshow(arr, aspect=auto) grid[0].cax.colorbar(im1) On Sat, Aug 20, 2011 at 2:43 PM, gru...@bigpond.net.au gru...@bigpond.net.au wrote: Usually imshow(arr, aspect='auto') or imshow(arr, aspect=2.0) will display the image with pixels having some aspect ratio other than 1:1 However, I cannot get this to work when using imshow within an AxesGrid axis. Is there a way to get an array shown with imshow() within an AxesGrid axis to have a pixel aspect other than 1:1 ? If not, is there a simple way to add a shared colorbar when using subplots() ? Gary -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Defining coordinates for contour plot
Hello, I'm trying to make a contour plot and I'm running into problems when specifying the coordinates for the plot. I do, #Specify coordinates of the surface delta0=1.0 delta1=0.1 x=np.arange(0.0, 6.0, delta0) y=np.arange(-1.0,3.0, delta1) #Contour the arrays. plt.contour(x, y, O3, O3Level) And I get an error that says, TypeError: Length of x must be number of columns in z, and length of y must be number of rows. I don't understand how I'm supposed to get the coordinates for the plot that I want and make x and y the same shape as z. Any suggestions? Thanks, Alexa -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Defining coordinates for contour plot
On 08/20/2011 02:03 AM, Alexa Villaume wrote: Hello, I'm trying to make a contour plot and I'm running into problems when specifying the coordinates for the plot. I do, #Specify coordinates of the surface delta0=1.0 delta1=0.1 x=np.arange(0.0, 6.0, delta0) y=np.arange(-1.0,3.0, delta1) #Contour the arrays. plt.contour(x, y, O3, O3Level) And I get an error that says, TypeError: Length of x must be number of columns in z, and length of y must be number of rows. I don't understand how I'm supposed to get the coordinates for the plot that I want and make x and y the same shape as z. Any suggestions? Contouring requires data on a grid, so your O3 needs to be a 2-D array of z values, and your x and y need to specify the x and y locations of *those* z values. The orientation is such that the first dimension of the z array corresponds to y, and the second corresponds to x. Eric Thanks, Alexa -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] [SciPy-User] getting started with arrays and matplotlib
On 07/08/2011 22:29, David Warde-Farley wrote: Secondly, once I've populated this, any good examples of how to turn it into a bar chart? (the simple bar chart would be number of sales on the y-axis, weeks before the event on the x-axis, however, what I'd then like to do is split each bar into chunks for each venue's sales, if that makes sense?) This might give you an example of what you need: http://matplotlib.sourceforge.net/examples/pylab_examples/bar_stacked.html but you'd be better off asking on matplotlib-users. Thanks, that was a good start. One question: How can I automatically get a list of colours for each bar? I don't know how many bars I'm going to have so I can't manually pick them... This feels like a common enough problem that I'm guessing there's a solution somewhere in matplotlib? cheers, Chris -- Simplistix - Content Management, Batch Processing Python Consulting - http://www.simplistix.co.uk -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users