From 602a0ff550e1e1850292e518a54ced6fc240c7b2 Mon Sep 17 00:00:00 2001 From: Peter Cock Date: Tue, 23 May 2023 13:37:19 +0100 Subject: [PATCH] Reverse stackplot legend to match data display This puts the legend key in the same order as the stacked data, with oceania at the top (near invisible), then europe, ..., with africa at the bottom. --- galleries/examples/lines_bars_and_markers/stackplot_demo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/galleries/examples/lines_bars_and_markers/stackplot_demo.py b/galleries/examples/lines_bars_and_markers/stackplot_demo.py index 958fab67c7d5..890a827fa156 100644 --- a/galleries/examples/lines_bars_and_markers/stackplot_demo.py +++ b/galleries/examples/lines_bars_and_markers/stackplot_demo.py @@ -30,7 +30,7 @@ fig, ax = plt.subplots() ax.stackplot(year, population_by_continent.values(), labels=population_by_continent.keys(), alpha=0.8) -ax.legend(loc='upper left') +ax.legend(loc='upper left', reverse=True) ax.set_title('World population') ax.set_xlabel('Year') ax.set_ylabel('Number of people (millions)')