20  StatsPlots

using StatsPlots

Basic plots using StatsPlots.jl.

20.1 Boxplot

x = randn(300);
y = randn(400) .+ 1.6;
z = randn(320) .- 2.2;
boxplot([x, y, z])

20.2 Density

density([x, y, z])

20.3 Histogram

histogram(x)
histogram([x, y, z])

20.4 Scatter

x = randn(300);
y = 3 .+ x.^3 + randn(300);
y2 = 4 .+ x.^2 + randn(300);
scatter(x, y)
scatter(x, [y, y2])

20.5 Barplot

x = ["alpha", "beta", "gamma"];
y = [3, 9, 5];
y2 = [5, 8, 7];
bar(x, y)
bar(x, [y, y2])

Currently, the GR backend does not allow stacking bars. The following would produce an error: “Keyword argument bar_position not supported with Plots.GRBackend()”

# bar(x, [y, y2], bar_position=:stack)

20.6 Resources