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.

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 <dcdavemail@...287...> 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

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

···

On Saturday, January 7, 2012, Jae-Joon Lee <lee.j.joon@…287…> 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