Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

## [Matplotlib-users] another problem with subplot...

 [Matplotlib-users] another problem with subplot... From: - 2006-11-02 21:58:06 ```and the same question: this behavior is normal? fig1 = figure() ax1 = subplot(121) xlim([0,10]) ax2 = subplot(122,sharey=ax1) yticks([]) I would like to hide the ticks label for only one subplot (the one who share the axes) but I would like to have the ticklabels for the global plot, ie on the left subplot. I was thinking that sharey means that the plot will have the same limit for this axes not to have all the properties. Do I have to tell to all the subplot to have the same limit and remove the ticks for the one I want? N. ```

 [Matplotlib-users] another problem with subplot... From: - 2006-11-02 21:58:06 ```and the same question: this behavior is normal? fig1 = figure() ax1 = subplot(121) xlim([0,10]) ax2 = subplot(122,sharey=ax1) yticks([]) I would like to hide the ticks label for only one subplot (the one who share the axes) but I would like to have the ticklabels for the global plot, ie on the left subplot. I was thinking that sharey means that the plot will have the same limit for this axes not to have all the properties. Do I have to tell to all the subplot to have the same limit and remove the ticks for the one I want? N. ```
 Re: [Matplotlib-users] another problem with subplot... From: Eric Firing - 2006-11-04 00:13:55 ```humufr@... wrote: > and the same question: this behavior is normal? > > fig1 = figure() > ax1 = subplot(121) > xlim([0,10]) > ax2 = subplot(122,sharey=ax1) > yticks([]) > > I would like to hide the ticks label for only one subplot (the one who share > the axes) but I would like to have the ticklabels for the global plot, ie on > the left subplot. > > I was thinking that sharey means that the plot will have the same limit for > this axes not to have all the properties. Do I have to tell to all the > subplot to have the same limit and remove the ticks for the one I want? The way axis sharing is implemented, everything is shared; a single axis object is used for more than one axes object. I agree that this is not always what one wants, but I think it would be quite difficult to change, so for now you will need to forgo the sharey kwarg and instead manually synchronize the properties that you want the axes to have in common. Unless John has a better idea, of course... Eric ```
 Re: [Matplotlib-users] another problem with subplot... From: John Hunter - 2006-11-04 02:35:01 ```>>>>> "Eric" == Eric Firing writes: Eric> The way axis sharing is implemented, everything is shared; a Eric> single axis object is used for more than one axes object. I Eric> agree that this is not always what one wants, but I think it Eric> would be quite difficult to change, so for now you will need Eric> to forgo the sharey kwarg and instead manually synchronize Eric> the properties that you want the axes to have in common. Eric> Unless John has a better idea, of course... This time I do :-) The axis doesn't share everything -- it shares a locator and the view limits. When you do ylim([]) you are telling the y tick locator to use no ticks, and this is shared. There is a workaround -- no terribly elegant but servicable, and one I use all the time. Suppose ax1 and ax2 share the xaxis and you only want tick labels on ax2 ax1 = fig.add_subplot(211) ax2 = fig.add_subplot(212, sharex=ax1) ax1.plot(something) ax2.plot(somethingelse) for label in ax1.get_xticklabels(): label.set_visible(False) The key idea is that the actual ticks are not shared (they can't be because their y locations are different). But their x locations are shared (which is why ax1.set_xlim([]) doesn't do what you want. But you can set the visibility property to make them invisible, which works. Should be a recipe in the cookbook, enterprising mailing list readers. JDH ```