 # Sharing axes on multiple subplots

Hello,

I am testing the newly added subplots function in ipython -pylab with the following code:

f, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2,2, sharey=True)
ax1.plot(np.random.random(20))
ax2.plot(np.random.random(20))
ax3.plot(np.random.random(20))
ax4.plot(np.random.random(20))

For some reason scaling the y-axes logaritmically works only on the focused figure canvas, the rest of the subplots are scaled in a distorted fashion. Axes labels change to proper notation but the scaling stays as if linear along with the data. See for better description: http://img408.imageshack.us/img408/7149/logscale.png

Any ideas?

···

Gökhan

In the current implementation, sharing the axis does not mean sharing its scale.
This is not a subplots-specific issue, but applies to all kind of axes sharing.

So you need to change the scale of all the axes even though they have
shared axis.
What seems to be a better approach to me is to initialize "subplots"
with proper scale.

f, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2,2, sharey=True,
subplot_kw=dict(yscale="log"))

Regards,

-JJ

···

On Mon, Mar 22, 2010 at 1:18 PM, Gökhan Sever <gokhansever@...287...> wrote:

Hello,

I am testing the newly added subplots function in ipython -pylab with the
following code:

f, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2,2, sharey=True)
ax1.plot(np.random.random(20))
ax2.plot(np.random.random(20))
ax3.plot(np.random.random(20))
ax4.plot(np.random.random(20))

For some reason scaling the y-axes logaritmically works only on the focused
figure canvas, the rest of the subplots are scaled in a distorted fashion.
Axes labels change to proper notation but the scaling stays as if linear
along with the data. See for better description:
http://img408.imageshack.us/img408/7149/logscale.png

Any ideas?

--
Gökhan

------------------------------------------------------------------------------
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Yes, that makes it work.

Thank you JJ.

···

On Tue, Mar 23, 2010 at 10:58 AM, Jae-Joon Lee <lee.j.joon@…287…> wrote:

In the current implementation, sharing the axis does not mean sharing its scale.

This is not a subplots-specific issue, but applies to all kind of axes sharing.

So you need to change the scale of all the axes even though they have

shared axis.

What seems to be a better approach to me is to initialize “subplots”

with proper scale.

f, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2,2, sharey=True,

``````                                       subplot_kw=dict(yscale="log"))
``````

Regards,

-JJ

On Mon, Mar 22, 2010 at 1:18 PM, Gökhan Sever <gokhansever@…287…> wrote:

Hello,

I am testing the newly added subplots function in ipython -pylab with the

following code:

f, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2,2, sharey=True)

ax1.plot(np.random.random(20))

ax2.plot(np.random.random(20))

ax3.plot(np.random.random(20))

ax4.plot(np.random.random(20))

For some reason scaling the y-axes logaritmically works only on the focused

figure canvas, the rest of the subplots are scaled in a distorted fashion.

Axes labels change to proper notation but the scaling stays as if linear

along with the data. See for better description:

http://img408.imageshack.us/img408/7149/logscale.png

Any ideas?

Gökhan

Try the new software tools for yourself. Speed compiling, find bugs

proactively, and fine-tune applications for parallel performance.

See why Intel Parallel Studio got high marks during beta.

http://p.sf.net/sfu/intel-sw-dev

Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Gökhan