I tried to find this answer on the forum but I could not. I have made most of my plots with a grid, but this time it is easier to see what I want without a grid. However, the x-ticks disappeared while the y-ticks are still visible.
I have tried to make a minimum example below.
I have these as general for my plots
# Setting global font size for plots
small_size = 12
medium_size = 14
large_size = 16
plt.rc('axes', titlesize=large_size) # fontsize of the axes title
plt.rc('axes', labelsize=large_size) # fontsize of the x and y labels
plt.rc('xtick', labelsize=medium_size) # fontsize of the tick labels
plt.rc('ytick', labelsize=medium_size) # fontsize of the tick labels
plt.rc('legend',fontsize=medium_size) # fontsize of the legend
The plot below is mostly made by this script
fig, ax = plt.subplots(nrows=2, figsize=(13,7), sharex=True)
ax_y = ax[0].twinx()
ax_y.plot(df60.index, df60['sta'], color='magenta', label='STA') # linestyle = (0,(5, 10))
ax_y.plot(df60.index, df60['lta'], color='dodgerblue', label='LTA' )
ax[0].plot(df60.index, df60['displacement_butterfilt']-df60['displacement_butterfilt'][0], color='black', label='Displacement')
ax_2y = ax[1].twinx()
ax_2y.plot(df60.index, df60['sta'], color='magenta', label='STA') # linestyle = (0,(5, 10))
ax_2y.plot(df60.index, df60['lta'], color='dodgerblue', label='LTA' )
ax[1].plot(df60.index, df60['displacement_butterfilt']-df60['displacement_butterfilt'][0], color='black', label='Displacement')
# remove grid
ax[0].grid(False)
ax_y.grid(False)
ax[1].grid(False)
ax_2y.grid(False)
# start from 0 and remove space on each side of x-axis
ax[0].set_ylim(0, max(ax[0].get_ylim()))
ax[1].set_ylim(0, max(ax[0].get_ylim()))
ax[0].set_xlim(df60.index[0],df60.index[-1])
ax[1].set_xlim(df60.index[0],df60.index[-1])
fig.tight_layout()
plt.show()