Mathematica Asked on June 22, 2021
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}]
My goal is to generate the following format:
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}
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]}}]
Vary your text and colors as desired.
Correct answer by Jagra on June 22, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP