Skip to content

Commit

Permalink
Fix plots in Shapley tutorial (#161)
Browse files Browse the repository at this point in the history
* Fix plots in Shapley tutorial

* Drop support for older versions of CairoMakie in docs

* Fix axis limits

* Add missing comma
  • Loading branch information
devmotion authored Apr 9, 2024
1 parent f68be78 commit 556f0b8
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 17 deletions.
2 changes: 1 addition & 1 deletion docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"

[compat]
CairoMakie = "0.9, 0.10, 0.11"
CairoMakie = "0.11"
Copulas = "0.1"
Distributions = "0.25"
Documenter = "1"
Expand Down
40 changes: 24 additions & 16 deletions docs/src/tutorials/shapley.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,18 @@ shapley_effects = gsa(
```

```@example shapley
fig = Figure(resolution = (600, 400))
ax = barplot(fig[1, 1], collect(1:54), shapley_effects.shapley_effects, color = :green)
CairoMakie.ylims!(ax.axis, 0.0, 0.2)
ax.axis.xticks = (1:54, ["θ$i" for i in 1:54])
ax.axis.ylabel = "Shapley Indices"
ax.axis.xlabel = "Parameters"
ax.axis.xticklabelrotation = 1
display(fig)
barplot(
1:54, shapley_effects.shapley_effects;
color = :green,
figure = (; size = (600, 400)),
axis = (;
xlabel = "parameters",
xticklabelrotation = 1,
xticks = (1:54, ["θ$i" for i in 1:54]),
ylabel = "Shapley Indices",
limits = (nothing, (0.0, 0.2)),
),
)
```

Now let's assume some correlation between the parameters. We will use a correlation of 0.09 between
Expand All @@ -147,12 +151,16 @@ shapley_effects = gsa(
```

```@example shapley
fig = Figure(resolution = (600, 400))
ax = barplot(fig[1, 1], collect(1:54), shapley_effects.shapley_effects, color = :green)
CairoMakie.ylims!(ax.axis, 0.0, 0.2)
ax.axis.xticks = (1:54, ["θ$i" for i in 1:54])
ax.axis.ylabel = "Shapley Indices"
ax.axis.xlabel = "Parameters"
ax.axis.xticklabelrotation = 1
display(fig)
barplot(
1:54, shapley_effects.shapley_effects;
color = :green,
figure = (; size = (600, 400)),
axis = (;
xlabel = "parameters",
xticklabelrotation = 1,
xticks = (1:54, ["θ$i" for i in 1:54]),
ylabel = "Shapley Indices",
limits = (nothing, (0.0, 0.2)),
),
)
```

0 comments on commit 556f0b8

Please sign in to comment.