Skip to content
This repository has been archived by the owner on Jul 13, 2021. It is now read-only.

Commit

Permalink
jk/documenter master (#663)
Browse files Browse the repository at this point in the history
  • Loading branch information
jkrumbiegel authored Mar 18, 2021
1 parent f6fcbd8 commit ccf70c3
Show file tree
Hide file tree
Showing 33 changed files with 34 additions and 336 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
- name: Install binary dependencies
run: sudo apt-get update && sudo apt-get install -y xorg-dev mesa-utils xvfb libgl1 freeglut3-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxext-dev
- name: Install Julia dependencies
run: DISPLAY=:0 xvfb-run -s '-screen 0 1024x768x24' julia --project=docs -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'
run: DISPLAY=:0 xvfb-run -s '-screen 0 1024x768x24' julia --project=docs -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.add(url = "https://github.com/JuliaDocs/Documenter.jl", rev = "master"); Pkg.instantiate()'
- name: Build and deploy
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ bluemarble-2048.png
phases.0001_print.jpg
**/._*
Manifest.toml
!docs/Manifest.toml

\.DS_Store
2 changes: 1 addition & 1 deletion docs/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ src/generated
*.zip
tmax
prec
Manifest.toml
#Manifest.toml

src/assets/syntaxtheme.css

Expand Down
8 changes: 2 additions & 6 deletions docs/src/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,9 @@ ax2 = layout[1, 1] = Axis(scene, title = "Placed in Layout")
ax3 = Axis(scene, bbox = BBox(400, 800, 400, 800),
title = "Placed at BBox(400, 800, 400, 800)")
save("faq_squashed_element.svg", scene); nothing # hide
scene
```

![squashed elements](faq_squashed_element.svg)


### Columns or rows are shrunk to the size of Text or another element

Expand All @@ -141,11 +139,9 @@ layout[2, 1] = Axis(scene, title = "Expanded")
layout[1, 2] = Label(scene, "tellheight = true", tellheight = true)
layout[2, 2] = Label(scene, "tellheight = false", tellheight = false)
save("faq_shrunk_row.svg", scene); nothing # hide
scene
```

![shrunk row](faq_shrunk_row.svg)

```@eval
using GLMakie
GLMakie.activate!()
Expand Down
4 changes: 0 additions & 4 deletions docs/src/figure.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,8 @@ lines(pos2, cumsum(randn(100)))
heatmap(f[1, 3], randn(10, 10))
f
save("figurepositions.svg", f); nothing # hide
```

![figurepositions](figurepositions.svg)

You can also index further into a `FigurePosition`, which creates a `FigureSubposition`.
With `FigureSubposition`s you can describe positions in arbitrarily nested grid layouts.
Expand All @@ -92,10 +90,8 @@ f[1, 2][1, 1] = Axis(f, title = "I'm nested")
heatmap(f[1, 2][2, 1], randn(20, 20))
f
save("figurepositions_2.svg", f); nothing # hide
```

![figurepositions_2](figurepositions_2.svg)

All nested grid layouts that don't exist yet, but are needed for a nested plotting call, are created in the background automatically.

Expand Down
37 changes: 9 additions & 28 deletions docs/src/makielayout/axis.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,9 @@ scene, layout = layoutscene(resolution = (1200, 900))
ax = layout[1, 1] = Axis(scene, xlabel = "x label", ylabel = "y label",
title = "Title")
save("basic_axis.svg", scene) # hide
nothing # hide
scene
```

![basic axis](basic_axis.svg)

## Plotting Into an Axis

Expand All @@ -35,8 +33,7 @@ that it is more convenient to save and manipulate the plot objects.
```@example laxis
lineobject = lines!(ax, 0..10, sin, color = :red)
save("basic_axis_plotting.svg", scene) # hide
nothing # hide
scene
```

![basic axis plotting](basic_axis_plotting.svg)
Expand Down Expand Up @@ -74,8 +71,7 @@ ylims!(axes[4], (1, -1)) # as tuple, reversed
limits!(axes[5], 0, 2pi, -1, 1) # x1, x2, y1, y2
limits!(axes[6], BBox(0, 2pi, -1, 1)) # as rectangle
save("example_axis_limits.svg", scene) # hide
nothing # hide
scene
```

![axis limits](example_axis_limits.svg)
Expand Down Expand Up @@ -157,12 +153,9 @@ axes[4].xtickformat = "{:.2f}ms"
axes[4].xlabel = "Time"
save("example_axis_ticks.svg", scene) # hide
nothing # hide
scene
```

![axis ticks](example_axis_ticks.svg)

## Minor Ticks and Grids

You can show minor ticks and grids by setting `x/yminorticksvisible = true` and `x/yminorgridvisible = true` which are off by default.
Expand Down Expand Up @@ -192,11 +185,9 @@ fig = with_theme(theme) do
yminorticks = IntervalsBetween(n+1)) for n in 1:4]
fig
end
save("example_minor_ticks.svg", fig) # hide
nothing # hide
```
![minor ticks](example_minor_ticks.svg)
fig
```


## Hiding Axis Spines and Decorations
Expand All @@ -217,11 +208,9 @@ ax2 = layout[1, 2] = Axis(scene, title = "Axis 2")
hidespines!(ax1)
hidespines!(ax2, :t, :r) # only top and right
save("example_axis_hidespines.svg", scene) # hide
nothing # hide
scene
```

![axis hide spines](example_axis_hidespines.svg)

To hide decorations, you can use `hidedecorations!`, or the specific `hidexdecorations!` and `hideydecorations!`.
When hiding, you can set `label = false`, `ticklabels = false`, `ticks = false`, `grid = false`, `minorgrid = false` or `minorticks = false` as keyword
Expand Down Expand Up @@ -277,12 +266,9 @@ axes[2, 2].aspect = AxisAspect(2)
axes[2, 3].title = "AxisAspect(0.5)"
axes[2, 3].aspect = AxisAspect(0.5)
save("example_axis_aspects.svg", scene) # hide
nothing # hide
scene
```

![axis aspects](example_axis_aspects.svg)


## Controlling Data Aspect Ratios

Expand Down Expand Up @@ -386,12 +372,9 @@ for i in 1:3
end
end
save("example_linked_axes.svg", scene) # hide
nothing # hide
scene
```

![linked axes](example_linked_axes.svg)


## Axis interaction

Expand Down Expand Up @@ -526,10 +509,8 @@ ax2 = layout[1, 2] = Axis(scene, title = "hlines")
hlines!(ax2, [1, 2, 3, 4], xmax = [0.25, 0.5, 0.75, 1], color = :blue)
scene
save("example_vlines.svg", scene); nothing # hide
```

![example vlines](example_vlines.svg)

```@eval
using GLMakie
Expand Down
3 changes: 1 addition & 2 deletions docs/src/makielayout/box.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ 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
fig
```

![example lrect](example_lrect.svg)
4 changes: 0 additions & 4 deletions docs/src/makielayout/button.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,4 @@ for button in buttons
end
fig
save("example_lbutton.svg", fig); nothing # hide
```

![example lbutton](example_lbutton.svg)
7 changes: 0 additions & 7 deletions docs/src/makielayout/colorbar.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,8 @@ Colorbar(fig[4, 1], height = 25, limits = (-1, 1), colormap = :heat,
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
Expand Down Expand Up @@ -69,8 +65,5 @@ ax, hm = contourf(fig[2, 2][1, 1], xs, ys, zs,
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)

43 changes: 4 additions & 39 deletions docs/src/makielayout/gridlayout.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,8 @@ colsize!(layout, 1, Fixed(400))
# colsize!(layout, 1, 400) would also work
scene
save("example_fixed_size.svg", scene); nothing # hide
```

![fixed size](example_fixed_size.svg)


### Relative

`Relative(fraction)` is used to set a column or row to a size that is a certain fraction of the available width or height.
Expand All @@ -50,11 +46,8 @@ layout[1, 3] = Colorbar(scene, width = 30)
colsize!(layout, 1, Relative(2/3))
scene
save("example_relative_size.svg", scene); nothing # hide
```

![relative size](example_relative_size.svg)


### Auto

Expand Down Expand Up @@ -92,11 +85,8 @@ colsize!(layout, 2, Auto(1)) # equivalent to Auto(true, 1)
colsize!(layout, 3, Auto(2)) # equivalent to Auto(true, 2)
scene
save("example_auto_size.svg", scene); nothing # hide
```

![auto size](example_auto_size.svg)


### Aspect

Expand All @@ -120,11 +110,8 @@ rowsize!(layout, 2, Relative(2/3))
colsize!(layout, 1, Aspect(1, 1))
scene
save("example_aspect_size.svg", scene); nothing # hide
```

![aspect size](example_aspect_size.svg)

!!! note

Keep in mind that if you set too many constraints on row and column sizes, a GridLayout can easily be too big or too small. It's good to have variable-width elements to fill the remaining space if you use an element with fixed size or fixed aspect ratio.
Expand Down Expand Up @@ -152,11 +139,9 @@ subgl_right[1:3, 1] = [Axis(scene) for i in 1:3]
layout[1, 1] = subgl_left
layout[1, 2] = subgl_right
save("example_nested_grids.svg", scene); nothing # hide
scene
```

![example nested grids](example_nested_grids.svg)

## Alignment

Here you can see the difference between the align modes Outside with and without
Expand Down Expand Up @@ -185,10 +170,9 @@ subgl_3[1, 1] = Axis(scene, title="Outside(50)")
layout[1:3, 2] = [Box(scene, color = :transparent, strokecolor = :red) for i in 1:3]
save("example_grid_alignment.svg", scene); nothing # hide
scene
```

![example grid alignment](example_grid_alignment.svg)

## Spanned Placement

Expand All @@ -207,11 +191,9 @@ layout[:, 3] = Axis(scene, title="[:, 3]")
layout[1:3, end] = Axis(scene, title="[1:3, end]")
layout[end, end] = Axis(scene, title="[end, end]")
save("example_spanned_grid_content.svg", scene); nothing # hide
scene
```

![spanned grid content](example_spanned_grid_content.svg)

## Adding rows and columns by indexing

If you index outside of the current range of a grid layout, you do not get an
Expand All @@ -237,11 +219,9 @@ layout[2:end-1, 0] = Label(scene, text="Left Text", textsize=50,
layout[2:end-1, end+1] = Label(scene, text="Right Text", textsize=50,
rotation=-pi/2)
save("example_indexing_outside_grid.svg", scene); nothing # hide
scene
```

![indexing outside grid](example_indexing_outside_grid.svg)


## Trimming empty rows and columns

Expand All @@ -259,34 +239,25 @@ ax1 = layout[1, 1] = Axis(scene, title = "Axis 1")
ax2 = layout[1, 2] = Axis(scene, title = "Axis 2")
scene
save("example_trimming_1.svg", scene); nothing # hide
```

![trimming 1](example_trimming_1.svg)

Now we decide we'd like the second axis better if it was below the first one.
We move it two the new cell, and the old unused column is left blank.

```@example trimming
layout[2, 1] = ax2
scene
save("example_trimming_2.svg", scene); nothing # hide
```

![trimming 2](example_trimming_2.svg)

We can get rid of the unused space with `trim!`:

```@example trimming
trim!(layout)
scene
save("example_trimming_3.svg", scene); nothing # hide
```

![trimming 3](example_trimming_3.svg)


## Tweaking space between rows and columns

Expand All @@ -308,22 +279,16 @@ hidedecorations!.(axs, grid=false)
colgap!(fig.layout, 1, Relative(0.15))
fig
save("example_spacing_1.svg", fig); nothing # hide
```

![spacing 1](example_spacing_1.svg)

All spaces can be changed at once by omitting the index of the gap to resize.

```@example spacing
rowgap!(fig.layout, 50)
fig
save("example_spacing_2.svg", fig); nothing # hide
```

![spacing 2](example_spacing_2.svg)


```@eval
using GLMakie
Expand Down
5 changes: 1 addition & 4 deletions docs/src/makielayout/label.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,5 @@ 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
fig
```

![example ltext](example_ltext.svg)

Loading

0 comments on commit ccf70c3

Please sign in to comment.