番茄的季節
在這個練習中,你將按月份分析印度不同市場的番茄價格。你會使用箱形圖與小提琴圖的組合,來視覺化各月份價格的分佈。箱形圖會顯示四分位數、中位數與離群值;小提琴圖則呈現分佈形狀,幫助你洞察模式與變異程度。
tomatoes DataFrame 與包含月份名稱的陣列 month_labels 都已載入並可直接使用。開始前,請在互動式命令列先檢視 tomatoes 資料集中 Date 欄位的格式。DataFrames、Dates 與 StatsPlots 套件已為你匯入。
本練習屬於課程
Julia 資料視覺化入門
練習說明
- 以
Month為 x 軸,為番茄繪製"Retail Price"的小提琴圖。 - 在同一張圖上加入番茄
"Retail Price"的箱形圖,並移除outliers的顯示。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# 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)")