
You would need to do the same for the y axis and also for minor ticks in case it's needed.

Note that in the above I only changed the ticker for the x axis and also only for the major ticks. Looking at the source code, the function does not create its own figure.So, you can create a figure and then set the desired axis as the current axis using plt.sca.

When subplots have a shared x-axis along a column, only the x tick labels of the bottom subplot are created. 'col': each subplot column will share an x- or y-axis. 'row': each subplot row will share an x- or y-axis. False or 'none': each subplot x- or y-axis will be independent. When creating subplots in Matplotlib, we can make the subplots share the same x axis or y axis by passing sharexTrue or shareyTrue to the plt. # The new ticker needs new locator and formatters True or 'all': x- or y-axis will be shared among all subplots. # Now remove axes from the grouper for xaxisĪxes.get_shared_x_axes().remove(axes) This is equivalent to passing when constructing the Axes, and cannot be used if the y-axis is already being shared with another Axes.

