CommencerCommencer gratuitement

Streaming while working

In this exercise, you will compare the daily hours of music streaming between respondents who stream during work and those who do not. The results will be grouped based on self-reported music effects on mental health, allowing for a meaningful comparison.

You can work with the provided streaming DataFrame, and the StatsPlots package has already been loaded for your convenience, so you can access the boxplot() function.

Cet exercice fait partie du cours

Introduction to Data Visualization with Julia

Afficher le cours

Instructions

  • Generate three box plots comparing the distribution of Hours_per_day of music streaming (y-axis) versus While_working status (x-axis), grouped by Music_effects, arranging the plots in a single row.
  • Assign the x-axis label as "Music While Working", ensuring it is only displayed in the middle plot and the y-axis label as "Hours Per Day", making it visible only in the first plot.
  • Set the y-axis bounds to span from 0 to 10 to ensure consistent scaling across all three box plots.

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

theme(:vibrant)
# Box plots
boxplot(
	streaming.____, streaming.____,
    group=streaming.____,
    outliers=false, linewidth=1,
    color=[:darkorange :springgreen2 :slateblue3],
    # Grid layout
    layout=(____, ____),
    # Axis labels
    xlabel=[____],
    ylabel=[____]
)
# Set y-axis limits
____(____, ____)
Modifier et exécuter le code