Juliaで学ぶデータ可視化入門
Gustavo Vieira Suñe
Data Analyst
kerala データフレーム:| Date | Centre | Commodity | Price |
|---|---|---|---|
| JAN-2001 | Ernakulam | Onion | 10.0 |
| JAN-2001 | Ernakulam | Wheat | 12.5 |
| JAN-2001 | Khozhikode | Onion | 9.0 |
| JAN-2001 | Khozhikode | Wheat | 14.0 |
| ... | ... | ... | ... |
| MAR-2021 | Trivandrum | Onion | 45.0 |
| MAR-2021 | Trivandrum | Wheat | 34.0 |
| Commodity | Mean Price |
|---|---|
| Onion | 25.7442 |
| Wheat | 20.6261 |

# ヒストグラムを描画 histogram( kerala[:, :Price],# ラベルを追加 label="Onion and Wheat", # 棒の色 color=:darkseagreen1, )# 軸ラベル xlabel!("Price (Rupees)") ylabel!("Frequency")

# ヒストグラムを描画 histogram( kerala[:, :Price], # ラベルを追加 label="Onion and Wheat", # 棒の色 color=:darkseagreen1,# ビン数 bins=20, ) # 軸ラベル xlabel!("Price (Rupees)") ylabel!("Frequency")

# ヒストグラムを描画
histogram(
kerala[:, :Price],
# ラベルを追加
label="Onion and Wheat",
# 棒の色
color=:darkseagreen1,
# ビン数
bins=range(0, 150, 75),
)
# 軸ラベル
xlabel!("Price (Rupees)")
ylabel!("Frequency")

# 正規化したヒストグラム histogram( kerala[:, :Price], # ラベルを追加 label="Onion and Wheat", # 棒の色 color=:darkseagreen1,# 正規化 normalize=true, ) # 軸ラベル xlabel!("Price (Rupees)") ylabel!("Probability")

using StatsPlotsdensity!( kerala[:, :Price], color=:black, linewidth=3, label=false )

using StatsPlots # グループ化ヒストグラム groupedhist( kerala[:, :Price],# 品目でグループ化 group=kerala[:, "Commodity"],# 色を指定 color=[:deeppink3 :wheat2] ) xlabel!("Price (Rupees)") ylabel!("Frequency")

using StatsPlots # 積み上げヒストグラム groupedhist( kerala[:, :Price], # 品目でグループ化 group=kerala[:, "Commodity"], # 色を指定 color=[:deeppink3 :wheat2]# 棒を積み上げ bar_position=:stack, )xlabel!("Price (Rupees)") ylabel!("Frequency")


| Commodity | Mean Price |
|---|---|
| Onion | 25.7442 |
| Wheat | 20.6261 |
| Commodity | Median Price |
|---|---|
| Onion | 20.0 |
| Wheat | 19.5 |
Juliaで学ぶデータ可視化入門