def formatspec_generals(ax, htax, fontsize=12, xlm=[1 / (dt * 12 * 15000), 1 / (dt * 1)], ylm=[-.01, .4]): # Condensed axis adjustments for general exam # Set grid, adjust axis #ax.grid(True,which='both',ls='dotted',lw=0.5) ax, htax = viz.make_axtime(ax, htax) # Set Axis limits and labels ax = viz.add_yrlines(ax) ax.set_xlim(xlm) htax.set_xlim(xlm) ax.set_ylim(ylm) ax.set_xlabel(r"Frequency (cycles/year)", fontsize=fontsize) return ax, htax
def lin_quickformat(ax, plotdt, freq): # Set tickparams and clone xtick = np.arange(0, 1.7, .2) ax.set_xticks(xtick) ax.set_ylabel("Power ($\degree C^{2} / cpy$)", fontsize=12) ax.set_xlabel("Frequency (cycles/year)", fontsize=12) htax = viz.twin_freqaxis(ax, freq, "Years", dt, mode='lin-lin', xtick=xtick) # Set xtick labels xtkl = ["%.1f" % (1 / x) for x in xtick] htax.set_xticklabels(xtkl) # Set some key lines ax = viz.add_yrlines(ax, dt=plotdt) ax.legend(fontsize=10) return ax, htax
P, freq, dof, r1 = sps # Plot if option is set if plotcesm: pps = ybx.yo_specplot(freq, P, dof, r1, tunit, dt=dt, clvl=clvl, axopt=axopt, clopt=clopt) fig, ax, h, hcl, htax, hleg = pps #ax,htax = viz.make_axtime(ax,htax) ax = viz.add_yrlines(ax) ax.set_title("%s Spectral Estimate \n nsmooth=%i, taper = %.2f" % (cnames[i], nsmooths[i], pct * 100) + r"%") ax.grid(True, which='both', ls='dotted') ax.set_ylabel(r"Frequency x Power $(^{\circ}C)^{2}$", fontsize=13) plt.tight_layout() plt.savefig("%sSpectralEstimate_%s_nsmooth%i_taper%i.png" % (outpath, cnames[i], nsmooths[i], pct * 100), dpi=200) CC = ybx.yo_speccl(freq, P, dof, r1, clvl) P = P * dt freq = freq / dt CC = CC * dt P1s.append(P) freq1s.append(freq) CLs.append(CC)