Tomato seasons
In this exercise, you will analyze tomato prices in different Indian markets by month. You will use a combined box plot and violin plot to visualize the distribution of prices in each month. The box plot will show quartiles, median, and outliers, while the violin plot will show distribution shape, providing insight into patterns and variability.
Both the tomatoes
DataFrame and an array month_labels
containing month names have been loaded and are ready for use. Before the exercise, examine the format of the Date
column in the tomatoes
dataset using the interactive shell. The DataFrames
, Dates
, and StatsPlots
packages have been imported for you.
This exercise is part of the course
Introduction to Data Visualization with Julia
Exercise instructions
- Generate a violin plot of
"Retail Price"
for tomatoes, withMonth
along the x-axis. - Add a box plot of
"Retail Price"
for tomatoes to the same figure, removing the view ofoutliers
.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Create a violin plot
____(tomatoes.____,
tomatoes[:, "____"],
label=false,
xticks=(1:12, month_labels),
color=:crimson)
# Add a box plot to the figure
____(tomatoes.____,
tomatoes[:, "____"],
label=false,
outliers=____,
color=:turquoise3)
ylabel!("Price (Rupees)")