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 = CSV.read("/home/browni/LasthrimProjection/importedenergydata.csv", DataFrame)
print(df)

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:
https://github.com/JuliaPlots/StatsPlots.jl

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