subplots with linked axes

I would like to plot two or three graphs as subplots in a figure and control the axes such that when one graph is zoomed the others are adjusted too. I was hoping there would be a notification mechanism which would allow me to catch a rescaling of one subplot and redraw the others in step. Can anyone suggest a method of doing this?

Nick Granger-Brown

···

This email may contain privileged or confidential information, which should only be used for the purpose for which it was sent by Xyratex. No further rights or licenses are granted to use such information. If you are not the intended recipient of this message, please notify the sender by return and delete it. You may not use, copy, disclose or rely on the information contained in it.

Internet email is susceptible to data corruption, interception and unauthorised amendment for which Xyratex does not accept liability. While we have taken reasonable precautions to ensure that this email is free of viruses, Xyratex does not accept liability for the presence of any computer viruses in this email, nor for any losses caused as a result of viruses.

Xyratex Technology Limited (03134912), Registered in England & Wales, Registered Office, Langstone Road, Havant, Hampshire, PO9 1SA.

The Xyratex group of companies also includes, Xyratex Ltd, registered in Bermuda, Xyratex International Inc, registered in California, Xyratex (Malaysia) Sdn Bhd registered in Malaysia, Xyratex Technology (Wuxi) Co Ltd registered in The People’s Republic of China and Xyratex Japan Limited registered in Japan.


ax1 = fig.add_subplot(211)
ax1.plot(something)

ax2 = fig.add_subplot(212, sharex=ax1) # ditto for sharey
ax2.plot(something_else)

JDH

···

On Feb 20, 2008 6:30 AM, Nick Granger-Brown <Nick_Granger-Brown@...1885...> wrote:

I would like to plot two or three graphs as subplots in a figure and control
the axes such that when one graph is zoomed the others are adjusted too. I
was hoping there would be a notification mechanism which would allow me to
catch a rescaling of one subplot and redraw the others in step. Can anyone
suggest a method of doing this?

It sounds like what you want is to use the "shared axis" functionality.

See the shared_axis_demo.py

http://matplotlib.sourceforge.net/examples/shared_axis_demo.py

Cheers,
Mike

Nick Granger-Brown wrote:

···

I would like to plot two or three graphs as subplots in a figure and control the axes such that when one graph is zoomed the others are adjusted too. I was hoping there would be a notification mechanism which would allow me to catch a rescaling of one subplot and redraw the others in step. Can anyone suggest a method of doing this?
*Nick Granger-Brown*
//

______________________________________________________________________
This email may contain privileged or confidential information, which should only be used for the purpose for which it was sent by Xyratex. No further rights or licenses are granted to use such information. If you are not the intended recipient of this message, please notify the sender by return and delete it. You may not use, copy, disclose or rely on the information contained in it.

Internet email is susceptible to data corruption, interception and unauthorised amendment for which Xyratex does not accept liability. While we have taken reasonable precautions to ensure that this email is free of viruses, Xyratex does not accept liability for the presence of any computer viruses in this email, nor for any losses caused as a result of viruses.

Xyratex Technology Limited (03134912), Registered in England & Wales, Registered Office, Langstone Road, Havant, Hampshire, PO9 1SA.

The Xyratex group of companies also includes, Xyratex Ltd, registered in Bermuda, Xyratex International Inc, registered in California, Xyratex (Malaysia) Sdn Bhd registered in Malaysia, Xyratex Technology (Wuxi) Co Ltd registered in The People's Republic of China and Xyratex Japan Limited registered in Japan.
______________________________________________________________________

------------------------------------------------------------------------

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

------------------------------------------------------------------------

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

Thanks Michael!

I'm new to this but I'm still kicking myself for not spotting it. Just
what I was looking for.

Nick Granger-Brown
+44 (0)23 9249 6727

···

-----Original Message-----
From: Michael Droettboom [mailto:mdroe@…86…]
Sent: 20 February 2008 13:21
To: Nick Granger-Brown
Cc: matplotlib-users@lists.sourceforge.net
Subject: Re: [Matplotlib-users] subplots with linked axes

It sounds like what you want is to use the "shared axis" functionality.

See the shared_axis_demo.py

http://matplotlib.sourceforge.net/examples/shared_axis_demo.py

Cheers,
Mike

Nick Granger-Brown wrote:

I would like to plot two or three graphs as subplots in a figure and
control the axes such that when one graph is zoomed the others are
adjusted too. I was hoping there would be a notification mechanism
which would allow me to catch a rescaling of one subplot and redraw
the others in step. Can anyone suggest a method of doing this?

*Nick Granger-Brown*
//

______________________________________________________________________
This email may contain privileged or confidential information, which
should only be used for the purpose for which it was sent by Xyratex.
No further rights or licenses are granted to use such information. If
you are not the intended recipient of this message, please notify the
sender by return and delete it. You may not use, copy, disclose or
rely on the information contained in it.

Internet email is susceptible to data corruption, interception and
unauthorised amendment for which Xyratex does not accept liability.
While we have taken reasonable precautions to ensure that this email
is free of viruses, Xyratex does not accept liability for the presence

of any computer viruses in this email, nor for any losses caused as a
result of viruses.

Xyratex Technology Limited (03134912), Registered in England & Wales,
Registered Office, Langstone Road, Havant, Hampshire, PO9 1SA.

The Xyratex group of companies also includes, Xyratex Ltd, registered
in Bermuda, Xyratex International Inc, registered in California,
Xyratex
(Malaysia) Sdn Bhd registered in Malaysia, Xyratex Technology (Wuxi)
Co Ltd registered in The People's Republic of China and Xyratex Japan
Limited registered in Japan.
______________________________________________________________________

----------------------------------------------------------------------
--

----------------------------------------------------------------------
--- This SF.net email is sponsored by: Microsoft Defy all challenges.
Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

----------------------------------------------------------------------
--

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

______________________________________________________________________
This email may contain privileged or confidential information, which should only be used for the purpose for which it was sent by Xyratex. No further rights or licenses are granted to use such information. If you are not the intended recipient of this message, please notify the sender by return and delete it. You may not use, copy, disclose or rely on the information contained in it.

Internet email is susceptible to data corruption, interception and unauthorised amendment for which Xyratex does not accept liability. While we have taken reasonable precautions to ensure that this email is free of viruses, Xyratex does not accept liability for the presence of any computer viruses in this email, nor for any losses caused as a result of viruses.

Xyratex Technology Limited (03134912), Registered in England & Wales, Registered Office, Langstone Road, Havant, Hampshire, PO9 1SA.

The Xyratex group of companies also includes, Xyratex Ltd, registered in Bermuda, Xyratex International Inc, registered in California, Xyratex (Malaysia) Sdn Bhd registered in Malaysia, Xyratex Technology (Wuxi) Co Ltd registered in The People's Republic of China and Xyratex Japan Limited registered in Japan.
______________________________________________________________________