Introduction to Data Visualization with Julia
Gustavo Vieira Suñe
Data Analyst
# Violin plot @df insurance violin( :Sex, :Charges, label=false, linewidth=0, fillcolor=:grey40 )# Add box plot @df insurance boxplot!( :Sex, :Charges, label=false, alpha=0.75, fillcolor=:mediumorchid3, outliers=false, ) ylabel!("Insurance Premium (USD)")

insurance DataFrame| Age | Sex | BMI | Children | Smoker | Region | Charges |
|---|---|---|---|---|---|---|
| 19 | female | 27.90 | 0 | yes | southwest | 16884.90 |
| 18 | male | 33.77 | 1 | no | southeast | 1725.55 |
| 28 | male | 33.00 | 3 | no | southeast | 4449.46 |
| ... | ... | ... | ... | ... | ... | ... |
@df recipe is compatible with the layout argument!@df insurance violin( :Sex, :Charges, group=:Region, linewidth=0, color=[:red :green :blue :purple], legend_position=:top,# Set layout layout=(2,2)) ylims!(0, 6*10^4) ylabel!("Premium (USD)")

@chain insurance begin # Smoker column to numeric transform(:Smoker => ByRow(x -> x == "yes" ? 100 : 0) => :Smoker)groupby([:Sex, :Children]) combine(:Smoker => mean)@df bar(:Children, :Smoker_mean, group=:Sex, linewidth=0, fillcolor=[:cyan4 :chocolate2], # Set layout layout=2)end ylims!(0, 35) xlabel!("Children") ylabel!("Percentage of Smokers")



Diagonals
Above diagonal
Below diagonal
# Using DataFrames recipe @df insurance corrplot(# Numerical columns [:Age :BMI],# Customize markercolor=:thermal, fillcolor=:acton )

# Using DataFrames recipe @df insurance corrplot( # Numerical columns [:Age :BMI :Children :Charges],# Customize markercolor=:thermal, fillcolor=:acton )

Introduction to Data Visualization with Julia