From 35d1f4b310dc378d3b9d8f63b2917337343ffd7b Mon Sep 17 00:00:00 2001 From: Mallory Row Date: Fri, 29 Oct 2021 12:29:32 +0000 Subject: [PATCH] Fix date tick label formats for newer matplotlib versions Refs: #84 --- ush/plotting_scripts/plot_date_by_level.py | 2 ++ ush/plotting_scripts/plot_lead_average.py | 2 ++ ush/plotting_scripts/plot_lead_by_date.py | 2 ++ ush/plotting_scripts/plot_lead_by_level.py | 2 ++ ush/plotting_scripts/plot_maps2d_lat_lon_errors.py | 2 ++ .../plot_maps2d_model2obs_calc_vars_lat_lon_errors.py | 2 ++ ush/plotting_scripts/plot_maps2d_zonal_mean_errors.py | 2 ++ ush/plotting_scripts/plot_mapsda_lat_lon_errors.py | 2 ++ ush/plotting_scripts/plot_mapsda_zonal_mean_errors.py | 2 ++ ush/plotting_scripts/plot_stat_by_level.py | 2 ++ ush/plotting_scripts/plot_threshold_average.py | 2 ++ ush/plotting_scripts/plot_threshold_by_lead.py | 2 ++ ush/plotting_scripts/plot_time_series.py | 2 ++ ush/plotting_scripts/plot_tropcyc_lead_average.py | 2 ++ 14 files changed, 28 insertions(+) diff --git a/ush/plotting_scripts/plot_date_by_level.py b/ush/plotting_scripts/plot_date_by_level.py index d0cda6b..c92a24e 100644 --- a/ush/plotting_scripts/plot_date_by_level.py +++ b/ush/plotting_scripts/plot_date_by_level.py @@ -53,6 +53,8 @@ plt.rcParams['figure.subplot.right'] = 0.95 plt.rcParams['figure.titleweight'] = 'bold' plt.rcParams['figure.titlesize'] = 16 +if float(matplotlib.__version__[0:3]) >= 3.3: + plt.rcParams['date.epoch'] = '0000-12-31T00:00:00' nticks = 2 title_loc = 'center' cmap_bias_original = plt.cm.PiYG_r diff --git a/ush/plotting_scripts/plot_lead_average.py b/ush/plotting_scripts/plot_lead_average.py index 8210165..4b69c5e 100644 --- a/ush/plotting_scripts/plot_lead_average.py +++ b/ush/plotting_scripts/plot_lead_average.py @@ -56,6 +56,8 @@ plt.rcParams['legend.borderaxespad'] = 0 plt.rcParams['legend.columnspacing'] = 1.0 plt.rcParams['legend.frameon'] = False +if float(matplotlib.__version__[0:3]) >= 3.3: + plt.rcParams['date.epoch'] = '0000-12-31T00:00:00' x_figsize, y_figsize = 14, 14 legend_bbox_x, legend_bbox_y = 0.5, 0.05 legend_fontsize = 15 diff --git a/ush/plotting_scripts/plot_lead_by_date.py b/ush/plotting_scripts/plot_lead_by_date.py index 4be213c..366e1df 100644 --- a/ush/plotting_scripts/plot_lead_by_date.py +++ b/ush/plotting_scripts/plot_lead_by_date.py @@ -52,6 +52,8 @@ plt.rcParams['figure.subplot.right'] = 0.95 plt.rcParams['figure.titleweight'] = 'bold' plt.rcParams['figure.titlesize'] = 16 +if float(matplotlib.__version__[0:3]) >= 3.3: + plt.rcParams['date.epoch'] = '0000-12-31T00:00:00' nticks = 4 title_loc = 'center' cmap_bias_original = plt.cm.PiYG_r diff --git a/ush/plotting_scripts/plot_lead_by_level.py b/ush/plotting_scripts/plot_lead_by_level.py index 9d02cf4..13e673a 100644 --- a/ush/plotting_scripts/plot_lead_by_level.py +++ b/ush/plotting_scripts/plot_lead_by_level.py @@ -53,6 +53,8 @@ plt.rcParams['figure.subplot.right'] = 0.95 plt.rcParams['figure.titleweight'] = 'bold' plt.rcParams['figure.titlesize'] = 16 +if float(matplotlib.__version__[0:3]) >= 3.3: + plt.rcParams['date.epoch'] = '0000-12-31T00:00:00' title_loc = 'center' cmap_bias_original = plt.cm.PiYG_r colors_bias = cmap_bias_original( diff --git a/ush/plotting_scripts/plot_maps2d_lat_lon_errors.py b/ush/plotting_scripts/plot_maps2d_lat_lon_errors.py index fc54ba4..8ac62b2 100644 --- a/ush/plotting_scripts/plot_maps2d_lat_lon_errors.py +++ b/ush/plotting_scripts/plot_maps2d_lat_lon_errors.py @@ -36,6 +36,8 @@ plt.rcParams['figure.subplot.right'] = 0.95 plt.rcParams['figure.titleweight'] = 'bold' plt.rcParams['figure.titlesize'] = 16 +if float(matplotlib.__version__[0:3]) >= 3.3: + plt.rcParams['date.epoch'] = '0000-12-31T00:00:00' title_loc = 'center' cmap_diff_original = plt.cm.bwr colors_diff = cmap_diff_original( diff --git a/ush/plotting_scripts/plot_maps2d_model2obs_calc_vars_lat_lon_errors.py b/ush/plotting_scripts/plot_maps2d_model2obs_calc_vars_lat_lon_errors.py index 70c4354..b231ce8 100644 --- a/ush/plotting_scripts/plot_maps2d_model2obs_calc_vars_lat_lon_errors.py +++ b/ush/plotting_scripts/plot_maps2d_model2obs_calc_vars_lat_lon_errors.py @@ -37,6 +37,8 @@ plt.rcParams['figure.subplot.right'] = 0.95 plt.rcParams['figure.titleweight'] = 'bold' plt.rcParams['figure.titlesize'] = 16 +if float(matplotlib.__version__[0:3]) >= 3.3: + plt.rcParams['date.epoch'] = '0000-12-31T00:00:00' title_loc = 'center' cmap_diff_original = plt.cm.bwr colors_diff = cmap_diff_original( diff --git a/ush/plotting_scripts/plot_maps2d_zonal_mean_errors.py b/ush/plotting_scripts/plot_maps2d_zonal_mean_errors.py index 2d91e2b..a208c9d 100644 --- a/ush/plotting_scripts/plot_maps2d_zonal_mean_errors.py +++ b/ush/plotting_scripts/plot_maps2d_zonal_mean_errors.py @@ -33,6 +33,8 @@ plt.rcParams['figure.subplot.right'] = 0.95 plt.rcParams['figure.titleweight'] = 'bold' plt.rcParams['figure.titlesize'] = 16 +if float(matplotlib.__version__[0:3]) >= 3.3: + plt.rcParams['date.epoch'] = '0000-12-31T00:00:00' title_loc = 'center' cmap_diff_original = plt.cm.bwr colors_diff = cmap_diff_original( diff --git a/ush/plotting_scripts/plot_mapsda_lat_lon_errors.py b/ush/plotting_scripts/plot_mapsda_lat_lon_errors.py index 8883863..ee452de 100644 --- a/ush/plotting_scripts/plot_mapsda_lat_lon_errors.py +++ b/ush/plotting_scripts/plot_mapsda_lat_lon_errors.py @@ -36,6 +36,8 @@ plt.rcParams['figure.subplot.right'] = 0.95 plt.rcParams['figure.titleweight'] = 'bold' plt.rcParams['figure.titlesize'] = 16 +if float(matplotlib.__version__[0:3]) >= 3.3: + plt.rcParams['date.epoch'] = '0000-12-31T00:00:00' title_loc = 'center' cmap_diff_original = plt.cm.bwr colors_diff = cmap_diff_original( diff --git a/ush/plotting_scripts/plot_mapsda_zonal_mean_errors.py b/ush/plotting_scripts/plot_mapsda_zonal_mean_errors.py index 05a1dcf..dd4e0dc 100644 --- a/ush/plotting_scripts/plot_mapsda_zonal_mean_errors.py +++ b/ush/plotting_scripts/plot_mapsda_zonal_mean_errors.py @@ -33,6 +33,8 @@ plt.rcParams['figure.subplot.right'] = 0.95 plt.rcParams['figure.titleweight'] = 'bold' plt.rcParams['figure.titlesize'] = 16 +if float(matplotlib.__version__[0:3]) >= 3.3: + plt.rcParams['date.epoch'] = '0000-12-31T00:00:00' title_loc = 'center' cmap_diff = plt.cm.bwr noaa_logo_img_array = matplotlib.image.imread( diff --git a/ush/plotting_scripts/plot_stat_by_level.py b/ush/plotting_scripts/plot_stat_by_level.py index 21d3e90..58d58a7 100644 --- a/ush/plotting_scripts/plot_stat_by_level.py +++ b/ush/plotting_scripts/plot_stat_by_level.py @@ -57,6 +57,8 @@ plt.rcParams['legend.borderaxespad'] = 0 plt.rcParams['legend.columnspacing'] = 1.0 plt.rcParams['legend.frameon'] = False +if float(matplotlib.__version__[0:3]) >= 3.3: + plt.rcParams['date.epoch'] = '0000-12-31T00:00:00' x_figsize, y_figsize = 14, 14 legend_bbox_x, legend_bbox_y = 0, 1 legend_fontsize = 17 diff --git a/ush/plotting_scripts/plot_threshold_average.py b/ush/plotting_scripts/plot_threshold_average.py index 0f08eaf..f486586 100644 --- a/ush/plotting_scripts/plot_threshold_average.py +++ b/ush/plotting_scripts/plot_threshold_average.py @@ -56,6 +56,8 @@ plt.rcParams['legend.borderaxespad'] = 0 plt.rcParams['legend.columnspacing'] = 1.0 plt.rcParams['legend.frameon'] = False +if float(matplotlib.__version__[0:3]) >= 3.3: + plt.rcParams['date.epoch'] = '0000-12-31T00:00:00' x_figsize, y_figsize = 14, 14 legend_bbox_x, legend_bbox_y = 0.5, 0.05 legend_fontsize = 15 diff --git a/ush/plotting_scripts/plot_threshold_by_lead.py b/ush/plotting_scripts/plot_threshold_by_lead.py index 7261c7d..93e66a4 100644 --- a/ush/plotting_scripts/plot_threshold_by_lead.py +++ b/ush/plotting_scripts/plot_threshold_by_lead.py @@ -52,6 +52,8 @@ plt.rcParams['figure.subplot.right'] = 0.95 plt.rcParams['figure.titleweight'] = 'bold' plt.rcParams['figure.titlesize'] = 16 +if float(matplotlib.__version__[0:3]) >= 3.3: + plt.rcParams['date.epoch'] = '0000-12-31T00:00:00' title_loc = 'center' cmap_bias_original = plt.cm.PiYG_r colors_bias = cmap_bias_original( diff --git a/ush/plotting_scripts/plot_time_series.py b/ush/plotting_scripts/plot_time_series.py index cfe58b6..d9b046d 100644 --- a/ush/plotting_scripts/plot_time_series.py +++ b/ush/plotting_scripts/plot_time_series.py @@ -60,6 +60,8 @@ plt.rcParams['legend.borderaxespad'] = 0 plt.rcParams['legend.columnspacing'] = 1.0 plt.rcParams['legend.frameon'] = False +if float(matplotlib.__version__[0:3]) >= 3.3: + plt.rcParams['date.epoch'] = '0000-12-31T00:00:00' x_figsize, y_figsize = 14, 7 nticks = 4 legend_bbox_x, legend_bbox_y = 0.5, 0.05 diff --git a/ush/plotting_scripts/plot_tropcyc_lead_average.py b/ush/plotting_scripts/plot_tropcyc_lead_average.py index d93592f..6f20501 100644 --- a/ush/plotting_scripts/plot_tropcyc_lead_average.py +++ b/ush/plotting_scripts/plot_tropcyc_lead_average.py @@ -33,6 +33,8 @@ plt.rcParams['legend.borderaxespad'] = 0 plt.rcParams['legend.columnspacing'] = 1.0 plt.rcParams['legend.frameon'] = False +if float(matplotlib.__version__[0:3]) >= 3.3: + plt.rcParams['date.epoch'] = '0000-12-31T00:00:00' x_figsize, y_figsize = 14, 7 legend_bbox_x, legend_bbox_y = 0, 1 legend_fontsize = 13