fig = plt.figure(figsize=(10, 3))
gs = plt.GridSpec(2, 2)
# Phased data
ax = fig.add_subplot(gs[:, 0])
ax.fill_between([-1, 2], 18, 16.7, color='lightgray', alpha=0.5)
for offset in (-1, 0, 1):
ax.errorbar(phase + offset, y, dy, fmt='.',
color='gray', ecolor='lightgray', capsize=0)
ax.plot(phase_fit, ls_generalized.model(phase_fit / f0, fmax_generalized),
color='black', label='floating mean model')
ax.plot(phase_fit, ls_standard.model(phase_fit / f0, fmax_standard),
color='gray', label='standard model')
ax.legend(loc='upper left')
ax.set(xlim=(-0.4, 1.6),
ylim=(18, 12),
xlabel='phase',
ylabel='mag');
#periodograms
ax1 = fig.add_subplot(gs[0, 1])
ax1.plot(freq, power_generalized, '-', color='black')
ax1.xaxis.set_major_formatter(plt.NullFormatter())
ax1.set(xlim=(0, 1),
ylim=(0, 1.2))
ax1.text(0.95, 0.9, 'Floating Mean Periodogram',
ha='right', va='top', transform=ax1.transAxes)
ax1.annotate('', (0.3, 0.95), (0.3, 1.2),
arrowprops=dict(arrowstyle="->", color='gray'))
ax2 = fig.add_subplot(gs[1, 1])
ax2.plot(freq, power_standard, '-', color='black')
ax2.set(xlim=(0, 1),
ylim=(0, 1.2),
xlabel='Frequency')
ax2.text(0.95, 0.9, 'Standard Periodogram',
ha='right', va='top', transform=ax2.transAxes)
ax2.annotate('', (0.3, 0.45), (0.3, 0.7),
arrowprops=dict(arrowstyle="->", color='gray'))
fig.text(0.52, 0.5, 'Lomb-Scargle Power', ha='right', va='center', rotation=90)
fig.savefig('fig20_standard_vs_floatingmean.pdf')