I have been through the pylab examples and many axis formatting questions, but am still unable to remove the microseconds from the x-axis in the plot below.
Original code before trying to alter axis/tick properties and its output.

#filenames to be read in
file0 = 'results'
#Get data from file strore in record array
def readIn(fileName):
temp = DataClass()
with open('%s.csv' % fileName) as csvfile:
temp = mlab.csv2rec(csvfile,names = ['date', 'band','lat'])
return temp
#plotting function(position number, x-axis data, y-axis data,
# filename,data type, units, y axis scale)
def iPlot(num,xaxi,yaxi,filename,types, units,scale):
plt.subplot(2,1,num)
plt.plot_date(xaxi,yaxi,'-')
plt.title(filename + "--%s" % types )
plt.ylabel(" %s %s " % (types,units))
plt.ylim(0,scale)
plt.xticks(rotation=20)
# Set plot Parameters and call plot funciton
def plot():
nameB = "Bandwidth"
nameL = "Latency"
unitsB = " (Mbps)"
unitsL = "(ms)"
scaleB = 30
scaleL = 500
iPlot(1,out0['date'],out0['lat'],file0,nameL,unitsL,scaleL)
iPlot(2,out0['date'],out0['band'],file0,nameB,unitsB,scaleB)
def main():
global out0
print "Creating plots..."
out0 = readIn(file0)
plot()
plt.show()
main()
My attempt was to alter the code above by adding:
months = date.MonthLocator() # every month
days = date.DayLocator()
hours = date.HourLocator()
minutes = date.MinuteLocator()
seconds = date.SecondLocator()
def iPlot(num,xaxi,yaxi,filename,types, units,scale):
plt.subplot(2,1,num)
plt.plot_date(xaxi,yaxi,'-')
plt.title(filename + "--%s" % types )
plt.ylabel(" %s %s " % (types,units))
plt.ylim(0,scale)
# Set Locators
ax.xaxis.set_major_locator(days)
ax.xaxis.set_minor_locator(hours)
majorFormatter = date.DateFormatter('%M-%D %H:%M:%S')
ax.xaxis.set_major_formatter(majorFormatter)
ax.autoscale_view()
Is the major formatter I'm setting being over written by a default on? Is there a way to just turn off the microseconds without mucking with the rest of the format? I am fairly unclear on where the microseconds come from as my data contains none.

axbeing set? fromsubplots(...)? Can you show that line?subplots? Is it simplyfig, ax = subplots()?