This repository has been archived by the owner on Jul 13, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move plotting function and layoutables docs into separate files (#659)
* move plotting function docs into separate files * join paths * path fix * another try * fixes * titles * change examples to cairomakie * more plotting functions changed to cairomakie, activate glmakie * more changes * bug * shift layoutables into their own files * layoutables examples get own pages, some more cairomakie * return scene * fix * generic page for layoutables * add small example of figure vs layoutscene * fix ref * dot * bbox example * use 1.5.3 * Update docs.yml * activate glmakie in lighting docs Co-authored-by: Simon <[email protected]>
- Loading branch information
1 parent
df2e052
commit 4bc1bc3
Showing
44 changed files
with
1,395 additions
and
875 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
```@eval | ||
using CairoMakie | ||
CairoMakie.activate!() | ||
``` | ||
|
||
# Box | ||
|
||
A simple rectangle poly that is layoutable. This can be useful to make boxes for | ||
facet plots or when a rectangular placeholder is needed. | ||
|
||
```@example | ||
using CairoMakie | ||
using ColorSchemes | ||
fig = Figure(resolution = (1200, 900)) | ||
rects = fig[1:4, 1:6] = [ | ||
Box(fig, color = c) | ||
for c in get.(Ref(ColorSchemes.rainbow), (0:23) ./ 23)] | ||
save("example_lrect.svg", fig); nothing # hide | ||
``` | ||
|
||
![example lrect](example_lrect.svg) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
```@eval | ||
using CairoMakie | ||
CairoMakie.activate!() | ||
``` | ||
|
||
# Button | ||
|
||
```@example | ||
using CairoMakie | ||
fig = Figure(resolution = (1200, 900)) | ||
Axis(fig[1, 1]) | ||
fig[2, 1] = buttongrid = GridLayout(tellwidth = false) | ||
buttons = buttongrid[1, 1:5] = [Button(fig, label = "Button $i") for i in 1:5] | ||
for button in buttons | ||
on(button.clicks) do n | ||
println("$(button.label[]) was clicked $n times.") | ||
end | ||
end | ||
fig | ||
save("example_lbutton.svg", fig); nothing # hide | ||
``` | ||
|
||
![example lbutton](example_lbutton.svg) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
```@eval | ||
using CairoMakie | ||
CairoMakie.activate!() | ||
``` | ||
|
||
# Colorbar | ||
|
||
A Colorbar needs a colormap and a tuple of low/high limits. | ||
The colormap's axis will then span from low to high along the visual representation of the colormap. | ||
You can set ticks in a similar way to `Axis`. | ||
|
||
Here's how you can create Colorbars manually. | ||
|
||
```@example | ||
using CairoMakie | ||
fig = Figure(resolution = (1200, 900)) | ||
Axis(fig[1, 1]) | ||
# vertical colorbars | ||
Colorbar(fig[1, 2], width = 25, limits = (0, 10), colormap = :viridis, | ||
flipaxis = false) | ||
Colorbar(fig[1, 3], width = 25, limits = (0, 5), | ||
colormap = cgrad(:Spectral, 5, categorical = true)) | ||
Colorbar(fig[1, 4], width = 25, limits = (-1, 1), colormap = :heat, | ||
highclip = :cyan, lowclip = :red, label = "Temperature") | ||
# horizontal colorbars | ||
Colorbar(fig[2, 1], height = 25, limits = (0, 10), colormap = :viridis, | ||
vertical = false) | ||
Colorbar(fig[3, 1], height = 25, limits = (0, 5), | ||
colormap = cgrad(:Spectral, 5, categorical = true), vertical = false) | ||
Colorbar(fig[4, 1], height = 25, limits = (-1, 1), colormap = :heat, | ||
label = "Temperature", vertical = false, flipaxis = false, | ||
highclip = :cyan, lowclip = :red) | ||
fig | ||
save("example_colorbar.svg", fig); nothing # hide | ||
``` | ||
|
||
![example colorbar](example_colorbar.svg) | ||
|
||
You can also automatically choose colormap and limits for certain plot objects by passing them as the second argument. | ||
|
||
```@example | ||
using CairoMakie | ||
xs = LinRange(0, 20, 50) | ||
ys = LinRange(0, 15, 50) | ||
zs = [cos(x) * sin(y) for x in xs, y in ys] | ||
fig = Figure(resolution = (1200, 900)) | ||
ax, hm = heatmap(fig[1, 1][1, 1], xs, ys, zs) | ||
Colorbar(fig[1, 1][1, 2], hm, width = 20) | ||
ax, hm = heatmap(fig[1, 2][1, 1], xs, ys, zs, colormap = :grays, | ||
colorrange = (-0.75, 0.75), highclip = :red, lowclip = :blue) | ||
Colorbar(fig[1, 2][1, 2], hm, width = 20) | ||
ax, hm = contourf(fig[2, 1][1, 1], xs, ys, zs, | ||
levels = -1:0.25:1, colormap = :heat) | ||
Colorbar(fig[2, 1][1, 2], hm, width = 20, ticks = -1:0.25:1) | ||
ax, hm = contourf(fig[2, 2][1, 1], xs, ys, zs, | ||
colormap = :Spectral, levels = [-1, -0.5, -0.25, 0, 0.25, 0.5, 1]) | ||
Colorbar(fig[2, 2][1, 2], hm, width = 20, ticks = -1:0.25:1) | ||
fig | ||
save("example_colorbar_2.svg", fig); nothing # hide | ||
``` | ||
|
||
![example colorbar 2](example_colorbar_2.svg) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
```@eval | ||
using CairoMakie | ||
CairoMakie.activate!() | ||
``` | ||
|
||
# Label | ||
|
||
This is just normal text, except it's also layoutable. A text's size is known, | ||
so rows and columns in a GridLayout can shrink to the appropriate width or height. | ||
|
||
```@example | ||
using CairoMakie | ||
fig = Figure(resolution = (1200, 900)) | ||
fig[1:2, 1:3] = [Axis(fig) for _ in 1:6] | ||
supertitle = Label(fig[0, :], "Six plots", textsize = 30) | ||
sideinfo = Label(fig[2:3, 0], "This text is vertical", rotation = pi/2) | ||
save("example_ltext.svg", fig); nothing # hide | ||
``` | ||
|
||
![example ltext](example_ltext.svg) | ||
|
Oops, something went wrong.