diff --git a/modules/util/bar_plot.py b/modules/util/bar_plot.py index 9f8967b45dc0593acb70443c43c7135e05a461cc..cf124297ce9715a00aaa953ec3644949d09b21c2 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])