On Apr 22, 2010, at 12:28 PM, Gökhan Sever <gokhanse...@gmail.com>  
wrote:

> Hello,
>
> Consider my simple test case:
>
> import matplotlib.pyplot as plt
>
> fp = plt.figure()
> ax1 = fp.add_subplot(4,1,1)
> ax1.plot(range(10))
> ax2 = fp.add_subplot(4,1,2)
> ax2.plot(range(10))
> ax1.xaxis.set_major_locator (plt.NullLocator ())
>
> ax3 = fp.add_subplot(4,1,3)
> ax3.plot(range(10))
> # Can't turn off
> ax3.xaxis.set_major_locator (plt.NullLocator ())
> ax4 = fp.add_subplot(4,1,4, sharex=ax3)
> ax4.plot(range(10))
> # Turn-off both ax3 and ax4
> #ax3.xaxis.set_major_locator (plt.NullLocator ())
>
> plt.show()
>
> When I share x-axis in between two plots I can't turn-off one axis'  
> major ticks. Depends on the location of the function call it either  
> turn nothing or all. Is it intended or a mal-functioning? (Shared  
> axis is for my screen view, I can live without it by turning off  
> sharex option since it won't make any difference for the final saved  
> figures.)
>

The standard trick is to make the ticklabels on one axes invisible

for label in ax.get_xticklabels():
     label.set_visible(False)


JDH


------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to