Introduction to Data Visualization with Julia
Gustavo Vieira Suñe
Data Analyst
using Plots
# Set theme
theme(thm::Symbol; kwargs...)
thm
) choices: :default
, :dark
, :ggplot2
, :juno
, ...kwargs
: set default attributesE.g., theme(:juno, linecolor=:red, linewidth=5)
showtheme(:ggplot2)
showtheme(:juno)
using DataFrames, CSV, Plots # Load dataset streaming = DataFrame(CSV.File("streaming.csv"))
# Group by genre grouped = groupby(streaming, "Fav genre") # Count genres counts = combine(grouped, nrow => :count)
# Bar chart with :default bar( counts[!, "Fav genre"], counts.count,
title="Favorite Music Genres" ylabel="Frequency", label=false, )
# Set the theme theme(:juno)
# Bar chart with :juno bar( counts[!, "Fav genre"], counts.count, label=false, ylabel="Frequency", title="Favorite Music Genres" )
theme( :juno,
# Default line color and width linecolor=:red, linewidth=5,
# Hide the axis lines framestyle=:grid )
bar( counts[!, "Fav genre"], counts.count, label=false, ylabel="Frequency", title="Favorite Music Genres" )
savefig("genres.png")
Introduction to Data Visualization with Julia