You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have finished an power spectrum density analysis recently by using .spectral(), and making significant analysis by using .signif_test(). However, I'm facing a problem about how I could plot optionally. Particularly, I want to adjust the 95% threshold curve's characters, such as linewidth, colors, and so on. But, through my search, neither could I print the 95% threshold data to make a plot, nor could I change the parameters to adjust it. I‘d greatly appreciate if you could answer my question on how I could print the 95% threshold data or change the parameters to adjust the 95% threshold curve.
My code is as follows: def Z_Score(data): mean = np.mean(data) # 均值 std_dev = np.std(data) # 标准差 norm_data = (data - mean) / std_dev return norm_data fg=xr.open_dataset("/mnt/e/wind_global/obs/masked/E-OBS_wind_monthly_mean_1×1_masked.nc").fg[:-6,:,:] fg_spatial=np.nanmean(fg,(1,2)) fg_de_spatial=signal.detrend(fg_spatial,axis=0,type="linear",bp=0,overwrite_data=False) fg_de_std_spatial=Z_Score(fg_de_spatial) time=np.arange(516) wind_speed=pyleo.Series(time=time,value=fg_de_std_spatial,time_name="cycles per year",time_unit="month") psd=wind_speed.spectral(method="mtm") psd_signif=psd.signif_test(qs=[0.95],number=5) fig, ax = psd_signif.plot(label="original",lgd_kwargs={"ncol":1},color="k",linewidth=2))
This is my plot:
Thanks, sincerely!
The text was updated successfully, but these errors were encountered:
To adjust the plot, you can use some of the arguments of the plot function directly to do what you need: plot(in_loglog=True, in_period=True, label=None, xlabel=None, ylabel='PSD', title=None, marker=None, markersize=None, color=None, linestyle=None, linewidth=None, transpose=False, xlim=None, ylim=None, figsize=[10, 4], savefig_settings=None, ax=None, legend=True, lgd_kwargs=None, xticks=None, yticks=None, alpha=None, zorder=None, plot_kwargs=None, signif_clr='red', signif_linestyles=['--', '-.', ':'], signif_linewidth=1, plot_beta=True, beta_kwargs=None)
In particular, look at signif_clr, signif_linestyles, and signif_linewidth. If you need something more granular and specific to your use case, make sure you return fig and ax:
I have finished an power spectrum density analysis recently by using .spectral(), and making significant analysis by using .signif_test(). However, I'm facing a problem about how I could plot optionally. Particularly, I want to adjust the 95% threshold curve's characters, such as linewidth, colors, and so on. But, through my search, neither could I print the 95% threshold data to make a plot, nor could I change the parameters to adjust it. I‘d greatly appreciate if you could answer my question on how I could print the 95% threshold data or change the parameters to adjust the 95% threshold curve.
My code is as follows:
def Z_Score(data): mean = np.mean(data) # 均值 std_dev = np.std(data) # 标准差 norm_data = (data - mean) / std_dev return norm_data fg=xr.open_dataset("/mnt/e/wind_global/obs/masked/E-OBS_wind_monthly_mean_1×1_masked.nc").fg[:-6,:,:] fg_spatial=np.nanmean(fg,(1,2)) fg_de_spatial=signal.detrend(fg_spatial,axis=0,type="linear",bp=0,overwrite_data=False) fg_de_std_spatial=Z_Score(fg_de_spatial) time=np.arange(516) wind_speed=pyleo.Series(time=time,value=fg_de_std_spatial,time_name="cycles per year",time_unit="month") psd=wind_speed.spectral(method="mtm") psd_signif=psd.signif_test(qs=[0.95],number=5) fig, ax = psd_signif.plot(label="original",lgd_kwargs={"ncol":1},color="k",linewidth=2))
This is my plot:
Thanks, sincerely!
The text was updated successfully, but these errors were encountered: