[Matplotlib-users] Colorbar on each subplot
Hi, I need to add a colorbar to each plot in a subplot but cant seem to get it to work. My code is as follows, # Plot time series of slowness, baz, abs.power and rel.power labels = 'rel.power abs.power baz slow'.split() fig = plt.figure() for i, lab in enumerate(labels): ax = fig.add_subplot(4, 1, i + 1) ax.scatter(out[:, 0], out[:, i + 1], c=out[:, 1], alpha=0.6, edgecolors='none') ax.set_ylabel(lab) colorbar() fig.autofmt_xdate() fig.subplots_adjust(top=0.95, right=0.95, bottom=0.2, hspace=0.25) plt.show() Dont get any error but the colorbar is missing from the plot, anyone know how it is done -- View this message in context: http://old.nabble.com/Colorbar-on-each-subplot-tp33098035p33098035.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex infrastructure or vast IT resources to deliver seamless, secure access to virtual desktops. With this all-in-one solution, easily deploy virtual desktops for less than the cost of PCs and save 60% on VDI infrastructure costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Colorbar on each subplot
Please post a complete (but simple) example that we can easily test. Doing the *subplot_adjust* will mess up the location of colorbars, but I believe that colorbars should be still there. If you're using v1.1 and later, see if using the use_gridspec parameter works. For example, colorbar(use_gridspec=True) Regards, -JJ On Sat, Jan 7, 2012 at 8:34 PM, davcra dcdavem...@gmail.com wrote: Hi, I need to add a colorbar to each plot in a subplot but cant seem to get it to work. My code is as follows, # Plot time series of slowness, baz, abs.power and rel.power labels = 'rel.power abs.power baz slow'.split() fig = plt.figure() for i, lab in enumerate(labels): ax = fig.add_subplot(4, 1, i + 1) ax.scatter(out[:, 0], out[:, i + 1], c=out[:, 1], alpha=0.6, edgecolors='none') ax.set_ylabel(lab) colorbar() fig.autofmt_xdate() fig.subplots_adjust(top=0.95, right=0.95, bottom=0.2, hspace=0.25) plt.show() Dont get any error but the colorbar is missing from the plot, anyone know how it is done -- View this message in context: http://old.nabble.com/Colorbar-on-each-subplot-tp33098035p33098035.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex infrastructure or vast IT resources to deliver seamless, secure access to virtual desktops. With this all-in-one solution, easily deploy virtual desktops for less than the cost of PCs and save 60% on VDI infrastructure costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex infrastructure or vast IT resources to deliver seamless, secure access to virtual desktops. With this all-in-one solution, easily deploy virtual desktops for less than the cost of PCs and save 60% on VDI infrastructure costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] draw bbox around axes title
On Fri, Jan 6, 2012 at 4:56 AM, Skipper Seabold jsseab...@gmail.com wrote: but when I call show, it seems the width of the box is reset. Yes. Because the location of the texts are backend-dependent, the location of the xbox surrounding the text are recalculated during the drawing time. I don't think there is no easy workaround unfortunately. If you are experienced in matplotlib, you may try is to rewrite the get_path method of the bbox. The example code below, while a bit complicated, tries to make the the bbox align with the axes. ax.title.set_ha(left) bbox_get_path = bbox.get_path def my_get_path(): pad = bbox.get_boxstyle().pad*bbox.get_mutation_scale() x0, y0 = bbox.get_transform().transform_point((0,0)) xx = ax.bbox.x0 - x0 bbox.set_x(xx+pad) bbox.set_width(ax.bbox.width-2*pad) return bbox_get_path() bbox.get_path = my_get_path regards, -JJ -- Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex infrastructure or vast IT resources to deliver seamless, secure access to virtual desktops. With this all-in-one solution, easily deploy virtual desktops for less than the cost of PCs and save 60% on VDI infrastructure costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] matplotlib 1.1 TypeError: a float is required problem
On Saturday, January 7, 2012, Mingkui Li ken.mk...@gmail.com wrote: Yes, I think this is the origin of the Error. Thank you all! BTW, why the email title of all other people posts begin with '[matplotlib-user]'? does this should be added by hand every time when I post a topic? No, don't do that. The added part of the title is done automatically by the list server. However, on this list, we post replies on the bottom. Ben Root -- Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex infrastructure or vast IT resources to deliver seamless, secure access to virtual desktops. With this all-in-one solution, easily deploy virtual desktops for less than the cost of PCs and save 60% on VDI infrastructure costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Colorbar on each subplot
On Saturday, January 7, 2012, Jae-Joon Lee lee.j.j...@gmail.com wrote: Please post a complete (but simple) example that we can easily test. Doing the *subplot_adjust* will mess up the location of colorbars, but I believe that colorbars should be still there. If you're using v1.1 and later, see if using the use_gridspec parameter works. For example, colorbar(use_gridspec=True) Regards, -JJ Personally, I just simply use the AxesGrid1 toolkit which automatically allocates space for colorbars if I tell it to. Very easy to use. Ben Root -- Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex infrastructure or vast IT resources to deliver seamless, secure access to virtual desktops. With this all-in-one solution, easily deploy virtual desktops for less than the cost of PCs and save 60% on VDI infrastructure costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] exact figure size frustration
Hi, list- This question has been asked before, but all of my search results don't address my problem: code fig = figure(1, figsize=(3.25, 3)) plot([0,1,5,2,9]) title('title') xlabel('xAxis') ylabel('yAxis') fig.savefig('test.png',dpi=600) /code The resulting figure is 2040x1890 pixels, or 3.4x3.15, and the xlabel is cut off. Looking at the PNG file in an image editor, it appears that the axes and ticklabels fit the desired size. I've tried taking the difference from the output size and requested size and feeding that back in (3.25 - (3.4-3.25) = 3.10, but matplotlib seems to add an arbitrary buffer and it still doesn't come out to the desired size. How does one make an overall figure that is the desired size? Thanks, Ethan -- Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex infrastructure or vast IT resources to deliver seamless, secure access to virtual desktops. With this all-in-one solution, easily deploy virtual desktops for less than the cost of PCs and save 60% on VDI infrastructure costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] exact figure size frustration
On 01/07/2012 07:01 PM, Ethan Swint wrote: Hi, list- This question has been asked before, but all of my search results don't address my problem: code fig = figure(1, figsize=(3.25, 3)) plot([0,1,5,2,9]) title('title') xlabel('xAxis') ylabel('yAxis') fig.savefig('test.png',dpi=600) /code The resulting figure is 2040x1890 pixels, or 3.4x3.15, and the xlabel is cut off. Looking at the PNG file in an image editor, it appears that the axes and ticklabels fit the desired size. I've tried taking the difference from the output size and requested size and feeding that back in (3.25 - (3.4-3.25) = 3.10, but matplotlib seems to add an arbitrary buffer and it still doesn't come out to the desired size. How does one make an overall figure that is the desired size? Ethan, There seem to be two questions here. First, when I run your code, I get a png file of the right size: test.png: PNG image data, 1950 x 1800, 8-bit/color RGBA, non-interlaced What version of mpl are you using? I don't recall that it ever had the property you are reporting, generating a larger figure than requested. The second question is about the xlabel getting cut off. This is happening because mpl is using default subplot parameters that leave plenty of space for tick labels and axis labels with the default figure size, but don't leave enough if the figure is much smaller, and leave too much if the figure is much bigger. The subplot parameters are expressed as fractions of the figure size, but the text does not scale automatically with the figure size. Therefore you have to either specify the Axes position manually to leave the right size margins, or use subplots_adjust. When a figure is displayed on the screen, there is a button on the toolbar that brings up a subplots_adjust widget; this can be used to find values appropriate for your figure size, which you can then supply to your script. In the standard set of mpl examples there are many instances of subplots_adjust, e.g., http://matplotlib.sourceforge.net/examples/pylab_examples/subplots_adjust.html Eric Thanks, Ethan -- Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex infrastructure or vast IT resources to deliver seamless, secure access to virtual desktops. With this all-in-one solution, easily deploy virtual desktops for less than the cost of PCs and save 60% on VDI infrastructure costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex infrastructure or vast IT resources to deliver seamless, secure access to virtual desktops. With this all-in-one solution, easily deploy virtual desktops for less than the cost of PCs and save 60% on VDI infrastructure costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users