Curve Fitting to a time series in the format ‘datetime’?

Instead of plotting datenums, use the associated datetimes. import numpy as np import matplotlib.pyplot as plt import matplotlib.dates as mdates import datetime as DT import time dates = [DT.datetime(1978, 7, 7), DT.datetime(1980, 9, 26), DT.datetime(1983, 8, 1), DT.datetime(1985, 8, 8)] y = [0.00134328779552718, 0.00155187668863844, 0.0039431374327427, 0.00780037563783297] yerr = [0.0000137547160254577, 0.0000225670232594083, 0.000105623642510075, 0.00011343121508] x = mdates.date2num(dates) … Read more

Show decimal places and scientific notation on the axis

This is really easy to do if you use the matplotlib.ticker.FormatStrFormatter as opposed to the LogFormatter. The following code will label everything with the format ‘%.2e’: import numpy as np import matplotlib.pyplot as plt import matplotlib.ticker as mtick fig = plt.figure() ax = fig.add_subplot(111) x = np.linspace(0, 300, 20) y = np.linspace(0,300, 20) y = … Read more

How to increase/reduce the fontsize of x and y tick labels

You can set the fontsize directly in the call to set_xticklabels and set_yticklabels (as noted in previous answers). This will only affect one Axes at a time. ax.set_xticklabels(x_ticks, rotation=0, fontsize=8) ax.set_yticklabels(y_ticks, rotation=0, fontsize=8) Note this method should only be used if you are fixing the positions of the ticks first (e.g. using ax.set_xticks). If you … Read more

Show decimal places and scientific notation on the axis of a matplotlib plot

This is really easy to do if you use the matplotlib.ticker.FormatStrFormatter as opposed to the LogFormatter. The following code will label everything with the format ‘%.2e’: import numpy as np import matplotlib.pyplot as plt import matplotlib.ticker as mtick fig = plt.figure() ax = fig.add_subplot(111) x = np.linspace(0, 300, 20) y = np.linspace(0,300, 20) y = … Read more