Introduction to Data Visualization with Julia
Gustavo Vieira Suñe
Data Analyst
layout
)using StatsPlots, DataFrames, CSV # Load dataset streaming = DataFrame( CSV.File("streaming.csv") )
# Create density plot density( streaming.Age, group=streaming."Frequency [K pop]", linewidth=2.5,
# Set layout layout=4, )
using Colors # Julia logo colors logocolors = Colors.JULIA_LOGO_COLORS colors = [logocolors.blue logocolors.red logocolors.green logocolors.purple]
density( streaming.Age, group=streaming."Frequency [K pop]", linewidth=2.5, layout=4, # Line colors linecolor=colors, )
density( streaming.Age, group=streaming."Frequency [K pop]", linewidth=2.5, linecolor=colors,
# Layout dimensions layout=(4, 1),
# Axis labels xlabel=["" "" "" "Age"], ylabel="Probability", )
# Axis bounds xlims!(10, 80) ylims!(0, 0.2)
theme(:wong) # Choose colors colors = [:purple :green3 :firebrick1]
# First box plot p1 = boxplot(streaming."Streaming service", streaming.Age,
# Group by streaming service group=streaming."Streaming service", color=colors,
label=false, ylabel="Age", # Remove outliers outliers=false)
# Second box plot
p2 = boxplot(
streaming."Streaming service",
streaming.Anxiety,
# Group by streaming service
group=streaming."Streaming service",
color=colors,
label=false,
ylabel="Anxiety",
# Remove outliers
outliers=false,
)
# Histograms p3 = histogram( streaming.Age, group=streaming."Streaming service", color=colors, # Remove lines linewidth=0,
# Set layout layout=(1, 3),
xlabel="Age", # Set y-axis labels ylabel=["Frequency" "" ""] )
# Select layout
layout = @layout [a b; c]
# Join the plots
plot(p1, p2, p3, layout=layout)
Introduction to Data Visualization with Julia