Skip to content

Commit eba24a3

Browse files
Update banc_examples.Rmd
1 parent 278fe1d commit eba24a3

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

vignettes/banc_examples.Rmd

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ vignette: >
88
%\VignetteEncoding{UTF-8}
99
---
1010

11-
```{r, include = FALSE}
11+
```{r setup, include = FALSE}
1212
knitr::opts_chunk$set(
1313
collapse = TRUE,
1414
comment = "#>"
@@ -17,7 +17,7 @@ knitr::opts_chunk$set(
1717

1818
Load packages
1919

20-
```{r}
20+
```{r packages}
2121
library(nat.ggplot)
2222
library(ggplot2)
2323
library(dplyr)
@@ -29,7 +29,7 @@ library(dplyr)
2929

3030
A minimal 2D view of neuron meshes with a predefined rotation matrix.
3131

32-
```{r}
32+
```{r basic}
3333
nat.ggplot::ggneuron(banc.meshes, rotation_matrix = banc_view)
3434
```
3535

@@ -39,7 +39,7 @@ nat.ggplot::ggneuron(banc.meshes, rotation_matrix = banc_view)
3939

4040
Layer meshes, a brain outline, and smoothed skeletons.
4141

42-
```{r}
42+
```{r brain_and_smooth}
4343
# Smooth skeletons for presentation
4444
banc.skels_smoothed <- nat::nlapply(banc.skels, nat::smooth_neuron, sigma = 5000)
4545
@@ -72,7 +72,7 @@ nat.ggplot::g.anat +
7272

7373
Use `nat::plot3d()` and `rgl` to rotate interactively, then capture the view. Disabled during build.
7474

75-
```{r, eval=FALSE}
75+
```{r rgl, eval=FALSE}
7676
if (requireNamespace("rgl", quietly = TRUE)) {
7777
nat::plot3d(banc.brain_neuropil, alpha = 0.3, col = "grey")
7878
nat::plot3d(banc.skels_smoothed)
@@ -87,7 +87,7 @@ if (requireNamespace("rgl", quietly = TRUE)) {
8787

8888
Define rotation matrices and reuse them to render consistent views.
8989

90-
```{r}
90+
```{r views}
9191
views <- list(
9292
side = structure(c(0.000764884985983372, 0.0153511334210634,
9393
-0.99988180398941, 0, -0.940421104431152, -0.339961022138596,
@@ -124,7 +124,7 @@ nat.ggplot::ggneuron(
124124

125125
Render the neuropil mesh as a translucent context layer.
126126

127-
```{r}
127+
```{r backdrop}
128128
nat.ggplot::ggneuron(
129129
banc.brain_neuropil,
130130
rotation_matrix = banc_view,
@@ -139,7 +139,7 @@ nat.ggplot::ggneuron(
139139

140140
Single colour, gradient, and per-neuron palettes.
141141

142-
```{r}
142+
```{r single}
143143
# Single colour
144144
nat.ggplot::g.anat +
145145
nat.ggplot::geom_neuron(
@@ -149,7 +149,7 @@ nat.ggplot::g.anat +
149149
)
150150
```
151151

152-
```{r}
152+
```{r gradient}
153153
# Gradient along arbour / depth
154154
nat.ggplot::g.anat +
155155
nat.ggplot::geom_neuron(
@@ -159,7 +159,7 @@ nat.ggplot::g.anat +
159159
)
160160
```
161161

162-
```{r}
162+
```{r multicolour}
163163
# Distinct colours per neuron
164164
neuron_colours <- c("#FF6B6B", "#4ECDC4", "#45B7D1", "#FFA07A", "#98D8C8")
165165
@@ -183,7 +183,7 @@ nat.ggplot::g.anat +
183183

184184
Overlay synaptic sites as points; separate by `prepost` (0 = outputs, 1 = inputs).
185185

186-
```{r}
186+
```{r synapses}
187187
syns_pre <- dplyr::filter(banc.syns, prepost == 0)
188188
syns_post <- dplyr::filter(banc.syns, prepost == 1)
189189
@@ -216,7 +216,7 @@ nat.ggplot::g.anat +
216216

217217
Colour compartments using flow-centrality-based identities.
218218

219-
```{r}
219+
```{r flow}
220220
# Single neuron
221221
nat.ggplot::ggneuron(
222222
banc.neurons.flow[[1]],
@@ -226,7 +226,7 @@ nat.ggplot::ggneuron(
226226
)
227227
```
228228

229-
```{r}
229+
```{r many_flow}
230230
# Multiple neurons (with optional brain volume)
231231
nat.ggplot::ggneuron(
232232
banc.neurons.flow,
@@ -243,7 +243,7 @@ nat.ggplot::ggneuron(
243243

244244
Compute a bounding box in the rotated plane; zoom with `ggplot2::coord_fixed()`.
245245

246-
```{r}
246+
```{r bounded}
247247
mesh_bounds <- do.call(rbind, lapply(banc.meshes, function(mesh) {
248248
vertices <- t(mesh$vb[-4, ])
249249
if (!is.null(banc_view)) {

0 commit comments

Comments
 (0)