2
$\begingroup$

I have the following code to produce an almost fancy BarChart:

countries = CountryData["G7"];
data = {{2, 1, 1.5, 3, 3, 2.5, 4}, {-2, -1, -1.5, -3, -3, -2.5, -2}};
BarChart[data, PlotLabel -> "GDP Per Capita", PlotTheme -> "Business",
  ChartLabels -> Placed[countries, Below, Rotate[#, Pi/2.4] &], 
 ChartStyle -> {{Blue, Green}, None}, 
 ChartLegends -> {{"high", "low"}, None}] 

enter image description here

My goal is to generate the following format:

enter image description here

I want to have the following modifications to convert my BarChart above. (1) Add a box Downside Scenario to the top of the bar chart in Brown color, and inside the same box add a line of text in small fonts like This is a scenario parameter set, (2) Add a secondary plot label GDP Per Capita in bold, and (3) add a second line of text under GDP per capita such as parameter domain: {1,2,3}

$\endgroup$

1 Answer 1

6
$\begingroup$

First thoughts...

countries = CountryData["G7"];
data = {{2, 1, 1.5, 3, 3, 2.5, 4}, {-2, -1, -1.5, -3, -3, -2.5, -2}};

Column[{
  TextCell["GDP Per Capital", "Section", FontColor -> White],
  TextCell["This is a scenario parameter set", FontSize -> 12, 
   FontColor -> White],
  "",
  TextCell["WorldGDP in 2020", FontWeight -> Bold, FontSize -> 20],
  TextCell["parameter domain:{1,2,3}", FontWeight -> Bold, 
   FontSize -> 12],
  "",
  TextCell["% Difference from baseline and contributions in % pts", 
   "TI"],
  BarChart[data,
   PlotTheme -> "Business",
   ChartLabels -> Placed[countries, Below, Rotate[#, Pi/2.4] &],
   ChartStyle -> {{Blue, Green}, None},
   ChartLegends -> {{"high", "low"}, None},
   ImageSize -> 500]
  },
 Alignment -> Center,
 Background -> {Automatic, {1 -> Darker[Red], 2 -> Darker[Red]}}]

enter image description here

Vary your text and colors as desired.

$\endgroup$
1
  • $\begingroup$ It is a nice figure. thanks very much. $\endgroup$ May 26, 2021 at 19:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.