Das mit der Y-Achse ist schon in Ordnung, die X-Achse enthaelt immer dieselbe Werte, die werden auch immer plain formatiert.
Hier ein lauffaehiges Beispiel; an der y-Achse steht wissenschaftliche Notation und ich bekomme sie nicht weg:
Code: Alles auswählen
import numpy as np
import matplotlib.pyplot as plt
y_i = [11.1044563514, 11.1228276748, 11.1361234115, 11.1298162168, 11.125134152199999]
y_r = [11.148667168999999, 11.10194503, 11.112352465300001, 11.111687871799999, 11.1214449011]
dates_i = [2.83611000e-01, 2.69330463e+02, 2.70280648e+02, 2.72320822e+02, 2.73250579e+02]
dates_r = [311.28215, 324.25844, 325.25194, 330.20983, 338.21356]
diff = 0.16
ra = [112.5379659, 110.5349726]
dec = [ -15.9841039, -16.1061281]
med_i = np.median(y_i)
med_r = np.median(y_r)
plt.figure("i_only", figsize=(14.40, 9.00), dpi=100)
if y_r == []:
plt.plot(dates_i, np.asarray(y_i), 'r-', label = 'i_s')
plt.title('i_mag', fontsize='16')
else:
plt.plot(dates_r, np.asarray(y_r), 'g-', label = 'r_s')
plt.plot(dates_i, np.asarray(y_i), 'r-', label = 'i_s')
plt.title('i_mag', fontsize='16')
plt.rcParams['xtick.major.pad']=10
plt.rcParams['ytick.major.pad']=10
ax = plt.gca()
ax.title.set_y(1.1)
formy = plt.ScalarFormatter()
formy.set_powerlimits((-5, 5))
formy.set_scientific(False)
ax.yaxis.set_major_formatter(formy)
ax.set_ylim(ax.get_ylim()[::-1])
for tick in ax.xaxis.get_major_ticks():
tick.label.set_fontsize(16)
for tick in ax.yaxis.get_major_ticks():
tick.label.set_fontsize(16)
plt.xlabel('Days', fontsize='20', labelpad=20)
plt.ylabel('normalized magnitude / mag', fontsize='20', labelpad=20)
if y_r == []:
plt.legend(bbox_to_anchor=(0., 1.02, 1., 0.102), loc=3, mode='expand',
numpoints=1, ncol=2, borderaxespad=0.)
else:
plt.legend(bbox_to_anchor=(0., 1.02, 1., 0.102), loc=3, mode='expand',
numpoints=1, ncol=2, borderaxespad=0.)
leg = plt.gca().get_legend()
ltext = leg.get_texts()
plt.setp(ltext, fontsize='16')
plt.savefig('lc0.png', facecolor='white', bbox_inches='tight')
plt.close("i_only")