## [Matplotlib-users] Shared axis question

 [Matplotlib-users] Shared axis question From: Clovis Goldemberg - 2005-12-22 12:09:58 ```Consider the following code (adapted from shared_axis_demo.py): from pylab import * t = arange(0.01, 5.0, 0.01) s1 = sin(2*pi*t) s2 = sin(4*pi*t) s3 = sin(6*pi*t) ax1 = subplot(311) plot(t,s1) grid('True') ax2 = subplot(312, sharex=ax1) plot(t, s2) grid('True') ax3 = subplot(313, sharex=ax1) plot(t, s3) grid('True') show() When I use the zoom feature of the NavigationToolbar, the xaxis is shared between all 3 graphs. But the yaxis limits are free. Obviously, they could also be shared but this is not want I want. I would like to "force" or "freeze" the Y axis to a given value. Consequently, the zoom feature would act only along the X axis. Any ideas?? Clovis Goldemberg University of Sao Paulo ```

### Thread view

 [Matplotlib-users] Shared axis question From: Clovis Goldemberg - 2005-12-22 12:09:58 ```Consider the following code (adapted from shared_axis_demo.py): from pylab import * t = arange(0.01, 5.0, 0.01) s1 = sin(2*pi*t) s2 = sin(4*pi*t) s3 = sin(6*pi*t) ax1 = subplot(311) plot(t,s1) grid('True') ax2 = subplot(312, sharex=ax1) plot(t, s2) grid('True') ax3 = subplot(313, sharex=ax1) plot(t, s3) grid('True') show() When I use the zoom feature of the NavigationToolbar, the xaxis is shared between all 3 graphs. But the yaxis limits are free. Obviously, they could also be shared but this is not want I want. I would like to "force" or "freeze" the Y axis to a given value. Consequently, the zoom feature would act only along the X axis. Any ideas?? Clovis Goldemberg University of Sao Paulo ```
 Re: [Matplotlib-users] Shared axis question From: John Hunter - 2005-12-22 13:01:53 ```>>>>> "Clovis" == Clovis Goldemberg writes: Clovis> When I use the zoom feature of the NavigationToolbar, the Clovis> xaxis is shared between all 3 graphs. But the yaxis Clovis> limits are free. Obviously, they could also be shared but Clovis> this is not want I want. I would like to "force" or Clovis> "freeze" the Y axis to a given value. Consequently, the Clovis> zoom feature would act only along the X axis. When using the right mouse zoom in pan/zoom mode, if you hold 'x' down the zoom will only be in the x direction. ditto for 'y'. It would be nice to support this for zoom to rect as well. On the todo list! JDH ```
 Re: [Matplotlib-users] Shared axis question From: Clovis Goldemberg - 2005-12-22 13:27:08 ```Dear John, Thanks for your support. Pressing the X/Y key works fine in the pan menu! I tested it! But my first suggestion would be an additional keyword in the subplot command, something like: ax2 = subplot(312, sharex=ax1, freezey=True) In fact, there would be necessary 2 additional keywords (freezex, freezey) that would disable limit changes after the subplot creation. Obviouly, if freezey=False or None, the axis limits would be free to be changed by the zooming tool. Clovis John Hunter wrote: >>>>>>"Clovis" == Clovis Goldemberg writes: >>>>>> >>>>>> > > Clovis> When I use the zoom feature of the NavigationToolbar, the > Clovis> xaxis is shared between all 3 graphs. But the yaxis > Clovis> limits are free. Obviously, they could also be shared but > Clovis> this is not want I want. I would like to "force" or > Clovis> "freeze" the Y axis to a given value. Consequently, the > Clovis> zoom feature would act only along the X axis. > >When using the right mouse zoom in pan/zoom mode, if you hold 'x' down >the zoom will only be in the x direction. ditto for 'y'. It would be >nice to support this for zoom to rect as well. On the todo list! > >JDH > > >------------------------------------------------------- >This SF.net email is sponsored by: Splunk Inc. Do you grep through log files >for problems? Stop! Download the new AJAX search engine that makes >searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! >http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click >_______________________________________________ >Matplotlib-users mailing list >Matplotlib-users@... >https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > > ```