import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import matplotlib.dates as mpl_dates
data = pd.read_csv('/ocean/cstang/general/7120-01-JAN-2017_slev.csv')
date = pd.to_datetime(data.iloc[:,0])
ssh = data.iloc[:,1]
fig,ax = plt.subplots()
ax.plot(date.iloc[330:365+30],ssh.iloc[330:365+30])
locator = mpl_dates.AutoDateLocator(interval_multiples=True, maxticks=10) #auto chooses ticks based on data
formatter = mpl_dates.AutoDateFormatter(locator) #auto formats based on how many ticks
ax.xaxis.set_major_locator(locator)
ax.xaxis.set_major_formatter(formatter)
ax.tick_params(axis='x')