Get startedGet started for free

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.

This exercise is part of the course

Introduction to Data Visualization with Julia

View Course

Exercise 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.

Hands-on interactive exercise

Have a go at this exercise by completing this sample 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
____(____, ____)
Edit and Run Code