Grouped Bar Chart¶
In this example, we will be plotting a grouped bar chart to show the GDP per capita for UK, USA, JPN and AUS between 2017 and 2020. The result looks as such:
To start off with, create a Datamodel with the code snippet below. Once we have a table with our data, in this case GDPPerCapita
table we need to prepare the dataset to plot the data. The following code snippet prepares the data by creating a table called GDPPerCapitaPlot
.
Next, we will add a visualisation to the Datamodel on the GDPPerCapitaPlot
table. Choose the '2D Chart' - 'Advanced', and fill in the options as below (For 'Color' in 'MARKERS' section choose Custom_Series and add series of colours in hex code for example #E4572E,#29335C,#F3A712,#A8C686,#669BBC
):
NB. Make sure the options under Marker Position Override are filled in as shown.
This will give us the following bar plot:
To add axis and get the final result, add a panel below the bar chart, then add a visualisation based on GDPPerCapitaPlot
table with the following information:
Editing and styling the axis and the divider gives us the desired chart.