simple colorbar question

Hi,

Is there an easy way to force a colorbar to not take up space from the Axes
it is being plotted next to? In the following example, what I would like is
for the top Axes to remain the same size as the bottom one, and for the
colorbar to place itself on the right of the top one. Is this easy to do?

···

---

import matplotlib.pyplot as mpl

fig = mpl.figure(figsize=(5,10))

ax1 = fig.add_axes([0.2,0.5,0.6,0.3])
s = ax1.scatter([0.5,0.6],[0.6,0.5],c=[0.5,0.6])

ax2 = fig.add_axes([0.2,0.1,0.6,0.3])

fig.colorbar(s,ax=ax1)

fig.canvas.draw()

---

Thanks,

Tom

--
View this message in context: http://www.nabble.com/simple-colorbar-question-tp24834470p24834470.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

Thomas Robitaille wrote:

Hi,

Is there an easy way to force a colorbar to not take up space from the Axes
it is being plotted next to? In the following example, what I would like is
for the top Axes to remain the same size as the bottom one, and for the
colorbar to place itself on the right of the top one. Is this easy to do?

---

import matplotlib.pyplot as mpl

fig = mpl.figure(figsize=(5,10))

ax1 = fig.add_axes([0.2,0.5,0.6,0.3])
s = ax1.scatter([0.5,0.6],[0.6,0.5],c=[0.5,0.6])

ax2 = fig.add_axes([0.2,0.1,0.6,0.3])

axcbar = fig.add_axes([0.85, 0.5, 0.07, 0.3])
fig.colorbar(s, cax=axcbar)

Eric

···

fig.canvas.draw()

---

Thanks,

Tom