Skip to content

Commit 53d3a42

Browse files
Improved plot dpi
1 parent 844fb00 commit 53d3a42

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+350
-193
lines changed

.Rbuildignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@
55
^LICENSE\.md$
66
^.*\.Rproj$
77
^\.Rproj\.user$
8+
^pkgdown$
9+
^\.github$

.github/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.html

.github/workflows/pkgdown.yaml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
2+
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
3+
on:
4+
push:
5+
branches: [main, master]
6+
pull_request:
7+
release:
8+
types: [published]
9+
workflow_dispatch:
10+
11+
name: pkgdown.yaml
12+
13+
permissions: read-all
14+
15+
jobs:
16+
pkgdown:
17+
runs-on: ubuntu-latest
18+
# Only restrict concurrency for non-PR jobs
19+
concurrency:
20+
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
21+
env:
22+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
23+
permissions:
24+
contents: write
25+
steps:
26+
- uses: actions/checkout@v4
27+
28+
- uses: r-lib/actions/setup-pandoc@v2
29+
30+
- uses: r-lib/actions/setup-r@v2
31+
with:
32+
use-public-rspm: true
33+
34+
- uses: r-lib/actions/setup-r-dependencies@v2
35+
with:
36+
extra-packages: any::pkgdown, local::.
37+
needs: website
38+
39+
- name: Build site
40+
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
41+
shell: Rscript {0}
42+
43+
- name: Deploy to GitHub pages 🚀
44+
if: github.event_name != 'pull_request'
45+
uses: JamesIves/[email protected]
46+
with:
47+
clean: false
48+
branch: gh-pages
49+
folder: docs

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ docs/figs/*.pdf
77
tests/testthat/Rplots.pdf
88
.httr-oauth
99
spare
10+
docs

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ Authors@R:
1111
comment = c(ORCID = "0000-0002-1195-0445")))
1212
Description: Functions for creating neuroanatomy plots in the ggplot2 style.
1313
License: GPL-3 + file LICENSE
14-
URL: https://github.com/natverse/nat.ggplot, https://natverse.github.io/nat.ggplot/
14+
URL: https://github.com/natverse/nat.ggplot, https://natverse.github.io/nat.ggplot/, http://natverse.org/nat.ggplot/
1515
BugReports: https://github.com/natverse/nat.ggplot/issues
1616
Depends:
17-
R (>= 3.5.0,
17+
R (>= 3.5.0)
1818
Imports:
1919
nat,
2020
ggplot2 (>= 3.5),

NAMESPACE

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ S3method(ggplot2_neuron_path,"NULL")
1515
S3method(ggplot2_neuron_path,mesh3d)
1616
S3method(ggplot2_neuron_path,neuron)
1717
S3method(ggplot2_neuron_path,neuronlist)
18-
S3method(prune_vertices,synapticneuron)
1918
export(g.anat)
2019
export(geom_neuron)
2120
export(ggneuron)

R/data.R

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@
3131
#' \dontrun{
3232
#' library(nat)
3333
#' library(nat.ggplot)
34-
#'
34+
#'
3535
#' # Plot the neurons
3636
#' plot3d(banc.skels)
37-
#'
37+
#'
3838
#' # Use with ggplot2
3939
#' library(ggplot2)
4040
#' ggplot() + geom_neuron(banc.skels, rotation_matrix = banc_view)
@@ -76,7 +76,7 @@
7676
#' \dontrun{
7777
#' library(ggplot2)
7878
#' library(nat.ggplot)
79-
#'
79+
#'
8080
#' # Plot synapses coloured by type
8181
#' ggplot(banc.syns, aes(x = X, y = Y)) +
8282
#' geom_point(aes(colour = factor(prepost)), alpha = 0.5) +
@@ -124,14 +124,14 @@
124124
#' \dontrun{
125125
#' library(nat.ggplot)
126126
#' library(ggplot2)
127-
#'
127+
#'
128128
#' # Plot split neurons showing axon/dendrite compartments
129-
#' ggplot() + geom_neuron(bc.neurons.flow[[1]], rotation_matrix = banc_view)
130-
#'
129+
#' ggplot() + geom_neuron(banc.neurons.flow[[1]], rotation_matrix = banc_view)
130+
#'
131131
#' # Plot all split neurons
132-
#' ggneuron(bc.neurons.flow, rotation_matrix = banc_view)
132+
#' ggneuron(banc.neurons.flow, rotation_matrix = banc_view)
133133
#' }
134-
"bc.neurons.flow"
134+
"banc.neurons.flow"
135135

136136
#' Low Resolution BANC Brain Neuropil Mesh
137137
#'
@@ -156,18 +156,18 @@
156156
#' \dontrun{
157157
#' library(nat.ggplot)
158158
#' library(ggplot2)
159-
#'
159+
#'
160160
#' # Plot brain neuropil with default view
161-
#' ggplot() +
162-
#' geom_neuron(banc.brain_neuropil,
163-
#' cols = c("grey75", "grey50"),
161+
#' ggplot() +
162+
#' geom_neuron(banc.brain_neuropil,
163+
#' cols = c("grey75", "grey50"),
164164
#' alpha = 0.3)
165-
#'
165+
#'
166166
#' # Plot with frontal view
167-
#' ggplot() +
168-
#' geom_neuron(banc.brain_neuropil,
167+
#' ggplot() +
168+
#' geom_neuron(banc.brain_neuropil,
169169
#' rotation_matrix = banc_view,
170-
#' cols = c("grey75", "grey50"),
170+
#' cols = c("grey75", "grey50"),
171171
#' alpha = 0.3)
172172
#' }
173173
"banc.brain_neuropil"
@@ -176,9 +176,7 @@
176176
#'
177177
#' @description
178178
#' A list of simplified mesh3d objects representing the 3D surface reconstructions
179-
#' of 5 LHPD2a1 neurons from the BANC connectome dataset. These meshes have been
180-
#' decimated to approximately 20% of their original face count for efficient
181-
#' visualisation whilst preserving morphological features.
179+
#' of 4 LHPD2a1 neurons from the BANC connectome dataset.
182180
#'
183181
#' @format A list of 5 mesh3d objects, each containing vertices and faces defining
184182
#' the 3D surface of a neuron.
@@ -204,15 +202,15 @@
204202
#' \dontrun{
205203
#' library(nat.ggplot)
206204
#' library(ggplot2)
207-
#'
205+
#'
208206
#' # Plot first neuron mesh
209-
#' ggplot() +
210-
#' geom_neuron(banc.meshes[[1]],
207+
#' ggplot() +
208+
#' geom_neuron(banc.meshes[[1]],
211209
#' rotation_matrix = banc_view,
212210
#' cols = c("purple", "magenta"))
213-
#'
211+
#'
214212
#' # Plot all neuron meshes
215-
#' ggneuron(banc.meshes,
213+
#' ggneuron(banc.meshes,
216214
#' rotation_matrix = banc_view,
217215
#' cols = c("purple", "magenta"))
218216
#' }
@@ -223,7 +221,7 @@
223221
#' @description
224222
#' A 4x4 rotation matrix for displaying BANC connectome data in a frontal view.
225223
#' This matrix can be applied to any 3D neuroanatomy data to rotate it into a
226-
#' standard frontal viewing orientation.
224+
#' standard frontal viewing orientation. Provded as an example for the user.
227225
#'
228226
#' @format A 4x4 numeric matrix representing a 3D rotation transformation.
229227
#'
@@ -239,17 +237,17 @@
239237
#' library(nat.ggplot)
240238
#' library(nat)
241239
#' library(ggplot2)
242-
#'
240+
#'
243241
#' # Use the frontal view for plotting
244-
#' ggplot() +
242+
#' ggplot() +
245243
#' geom_neuron(banc.skels, rotation_matrix = banc_view)
246-
#'
244+
#'
247245
#' # Create a custom view interactively
248246
#' plot3d(banc.brain_neuropil)
249247
#' # Rotate to desired angle with mouse
250248
#' my_view <- rgl_view()$userMatrix
251249
#' # Use custom view
252-
#' ggplot() +
250+
#' ggplot() +
253251
#' geom_neuron(banc.brain_neuropil, rotation_matrix = my_view)
254252
#' }
255253
"banc_view"

R/ggplot2.R

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ ggplot2_neuron_path.NULL <- function(x, rotation_matrix = NULL, ...) {
178178
#'
179179
#' # Plot split neurons showing axon/dendrite
180180
#' g.anat +
181-
#' geom_neuron(bc.neurons.flow[[1]],
181+
#' geom_neuron(banc.neurons.flow[[1]],
182182
#' rotation_matrix = banc_view)
183183
#'
184184
#' # Plot synapses as points
@@ -247,7 +247,7 @@ geom_neuron.neuron <- function(x = NULL,
247247
...),
248248
ggplot2::geom_point(mapping = ggplot2::aes(x = .data$X, y = .data$Y),
249249
data = soma,
250-
color = cols[1],
250+
color = "black", #cols[1],
251251
size = root,
252252
...),
253253
ggplot2::scale_color_gradient(low = cols[1],
@@ -689,7 +689,9 @@ geom_neuron.splitneuron <- function(x = NULL,
689689
# },
690690
ggplot2::geom_point(mapping = ggplot2::aes(x = .data$X, y = .data$Y),
691691
data = soma,
692-
color = cols[1], alpha = 0.75, size = root)
692+
color = "black", #cols[1],
693+
alpha = 0.75,
694+
size = root)
693695
)
694696

695697
# And synapses?
@@ -764,7 +766,7 @@ geom_neuron.splitneuron <- function(x = NULL,
764766
#' cols1 = c("lightblue", "darkblue"))
765767
#'
766768
#' # Visualise split neurons with custom colours
767-
#' ggneuron(bc.neurons.flow,
769+
#' ggneuron(banc.neurons.flow,
768770
#' volume = banc.brain_neuropil,
769771
#' rotation_matrix = banc_view,
770772
#' info = "LHPD2a1 neurons with axon/dendrite split")
@@ -809,8 +811,7 @@ ggneuron <- function(x,
809811
ggplot2::labs(title = info)
810812
}
811813

812-
#' @method prune_vertices synapticneuron
813-
#' @export
814+
# hidden
814815
prune_vertices.synapticneuron <- function (x, verticestoprune, invert = FALSE, ...){
815816
if(length(verticestoprune)==nrow(x$d)){
816817
warning('no points left after pruning')

0 commit comments

Comments
 (0)