Plot from DataFrames using StatsPlots

Hi all,

I just learn about using csv and create dataframe. This is my code:

using CSV
using DataFrames

df ="/home/browni/LasthrimProjection/importedenergydata.csv", DataFrame)

Capture d’écran_2022-07-09_22-25-57

Now, I want to plot it like this (the differences are setosa will be coal, versicolor will be oil, and virginica will be natural gas) and each group represent the country, if possible can I add custom marker like the country flag in circle?

I read this:

But, after reading that, I still have no idea how to create the plot…

You can try this:

using StatsPlots
@df df groupedbar(:Country, :Percentage, group=:Energy, ylabel="Percentage", bar_width=0.7, legend=:outertopright)
1 Like