Skip to content
This repository was archived by the owner on Apr 4, 2025. It is now read-only.

Commit 476159a

Browse files
authored
plotting examples (#11)
* disable running python and R in arrow example * recreate lattice plot in pure Julia * modular arithmetic * better aspect ratio * plotting livecoding * size tweak
1 parent a451fb2 commit 476159a

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

live_coding_sessions/plotting.jl

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
using CairoMakie
2+
# https://docs.makie.org/stable/tutorials/layout-tutorial
3+
scatter(1:8, 1:8)
4+
5+
f = Figure()
6+
ax = Axis(f[1,1])
7+
8+
scatter!(ax, 1:100, 1:100)
9+
10+
ablines!, hlines, vlines, scatterlines, lines
11+
12+
f
13+
14+
using AlgebraOfGraphics
15+
# https://aog.makie.org/stable/
16+
using SMLP2024: dataset
17+
using DataFrames
18+
19+
sleepstudy = dataset(:sleepstudy)
20+
21+
plt = data(sleepstudy) *
22+
mapping(:days, :reaction) *
23+
visual(Scatter)
24+
25+
draw(plt)
26+
27+
plt = data(sleepstudy) *
28+
mapping(:days => "Days of sleep deprivation",
29+
:reaction => "Reaction time (ms)") *
30+
visual(Scatter)
31+
32+
plt = data(sleepstudy) *
33+
mapping(:days => "Days of sleep deprivation",
34+
:reaction => "Reaction time (ms)";
35+
layout=:subj) *
36+
visual(Scatter)
37+
38+
plt = data(sleepstudy) *
39+
mapping(:days => "Days of sleep deprivation",
40+
:reaction => "Reaction time (ms)";
41+
layout=:subj) *
42+
(visual(Scatter) + linear())
43+
44+
using MixedModelsMakie
45+
# https://palday.github.io/MixedModelsMakie.jl/stable/api/
46+
fm1 = fit(MixedModel,
47+
@formula(reaction ~ 1 + days + (1 + days|subj)),
48+
sleepstudy)
49+
50+
shrinkageplot(fm1; ellipse=true)
51+
caterpillar(fm1; orderby=2)
52+
qqcaterpillar(fm1)
53+
qqnorm(fm1)
54+
coefplot(fm1)
55+
# ridgeplot(fm1) # for bootstrap

0 commit comments

Comments
 (0)