X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;f=tvt%2Fimg%2Fgen_stacked_barchart.py;h=ec73abb3911f46dce8a544210f31872a249e41f7;hb=5702796e5885e85b9e8dcc0d5160dccb9386b05f;hp=af3d6ec4b5e8f57ec30980186e3140a609863289;hpb=3fe94feeee0efd1922263aca9d578031e2283f61;p=phd-thesis.git diff --git a/tvt/img/gen_stacked_barchart.py b/tvt/img/gen_stacked_barchart.py index af3d6ec..ec73abb 100644 --- a/tvt/img/gen_stacked_barchart.py +++ b/tvt/img/gen_stacked_barchart.py @@ -44,7 +44,8 @@ print(df) fig, ax = plt.subplots() -ax.bar(df.columns, df.loc[components[-1]], label=components[-1]) +ax.bar(df.columns, df.loc[components[-1]], label=components[-1], + color=CB_color_cycle[-1]) baseline = df.loc[components[-1]] for i in range(len(components)-2, -1, -1): ax.bar(df.columns, df.loc[components[i]], label=components[i], @@ -81,8 +82,7 @@ ax.set_position([box.x0, box.y0, box.width * 0.7, box.height]) handles, labels = plt.gca().get_legend_handles_labels() ##order = list(range(len(components))) -order = list(range(len(components)-1, -1, -1)) -plt.legend([handles[idx] for idx in order],[labels[idx] for idx in order], loc='center left', bbox_to_anchor=(1, 0.5)) +plt.legend(reversed(handles),reversed(labels), loc='center left', bbox_to_anchor=(1, 0.5)) ##ax.legend()