From ec9331a5778daf46480b44551c7326f3b07fd203 Mon Sep 17 00:00:00 2001 From: tomrink <rink@ssec.wisc.edu> Date: Mon, 6 Feb 2023 15:09:49 -0600 Subject: [PATCH] snapshot... --- modules/util/bar_plot.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/modules/util/bar_plot.py b/modules/util/bar_plot.py index 9f8967b4..cf124297 100644 --- a/modules/util/bar_plot.py +++ b/modules/util/bar_plot.py @@ -38,6 +38,29 @@ def do_plot(group_names, group_values, value_labels, bar_colors, title=None, xla plt.show() +def do_plot_simple(x_values, y_values, color, title=None, xlabel=None, ylabel=None, ylim=None, barWidth=0.1): + fig, ax = plt.subplots() + if ylim is not None: + ax.set_ylim(ylim) + + plt.bar(np.arange(len(x_values)), y_values, color=color, width=barWidth, edgecolor='black') + + # Add xticks on the middle of the group bars + if xlabel is not None: + plt.xlabel(xlabel, fontweight='bold') + plt.xticks([r for r in range(len(x_values))], labels=[int(xlbl) for xlbl in x_values]) + + if ylabel is not None: + plt.ylabel(ylabel, fontweight='bold') + + if title is not None: + plt.title(title, fontweight='bold') + + # Create legend & Show graphic + plt.legend() + plt.show() + + def run_plot_cld_layers(cld_layer_bot, cld_layer_top, hgt_ref, x_values, start, end): plot_cld_layers(cld_layer_bot[start:end], cld_layer_top[start:end], hgt_ref[start:end], x_values[start:end]) -- GitLab