natverse / nat

NeuroAnatomy Toolbox: An R package for the (3D) visualisation and analysis of biological image data, especially tracings of single neurons.
https://natverse.org/nat/
61 stars 26 forks source link

Can't recreate the example on the reference site of nat: NeuroAnatomy Toolbox for wire frame plots #510

Closed Jsalas424 closed 1 year ago

Jsalas424 commented 1 year ago

I submitted a detailed question on Stack as well: https://stackoverflow.com/questions/75179871/cant-recreate-the-example-on-the-reference-site-of-nat-neuroanatomy-toolbox-fo

Per the reference docs for the nat package, I create a mesh3d object and use wire3d with the plotly engine options and I should get a wire mesh 3d plot that I can scroll over for info image

Instead I get this:

library(knitr)
library(nat)
library(dplyr)
rgl::setupKnitr(autoprint = TRUE)

plot_issue_dat <- structure(list(vb = structure(c(-3.02, -115.799, 203.187, 1, 
-0.715, -115.701, 202.444, 1, -3.024, -114.397, 201.275, 1, -2.058, 
-116.181, 203.556, 1, 4.437, -116.153, 205.384, 1, 4.471, -114.791, 
210.117, 1, 12.443, -105.538, 198.121, 1, 4.985, -107.238, 192.985, 
1, 5.458, -107.907, 193.987, 1, 5.061, -115.557, 207.515, 1, 
6.809, -114.172, 208.797, 1, 5.8, -115.493, 205.988, 1, 4.943, 
-111.077, 198.177, 1), dim = c(4L, 13L)), material = list(), 
    normals = NULL, texcoords = NULL, meshColor = "vertices", 
    it = structure(c(1L, 2L, 3L, 4L, 5L, 2L, 2L, 1L, 4L, 6L, 
    1L, 3L, 7L, 8L, 9L, 3L, 8L, 7L, 6L, 4L, 1L, 10L, 11L, 12L, 
    7L, 6L, 3L, 11L, 6L, 7L, 2L, 5L, 13L, 7L, 9L, 13L, 11L, 7L, 
    12L, 6L, 11L, 10L, 3L, 2L, 13L, 5L, 10L, 12L, 9L, 8L, 13L, 
    13L, 8L, 3L, 4L, 6L, 10L, 5L, 4L, 10L, 7L, 13L, 12L, 12L, 
    13L, 5L), dim = c(3L, 22L))), class = c("mesh3d", "shape3d"
))

options(nat.plotengine = 'plotly')
wire3d(plot_issue_dat)

image

jefferis commented 1 year ago

Sorry to hear you're having trouble. Please can you advise what version of nat you are using? This plotly functionality is not available with the CRAN version of nat, but only with the github version iirc. You can install that using

natmanager::install('natverse') # full install

or

natmanager::install(pkgs = 'nat') # just nat
Jsalas424 commented 1 year ago

I installed nat v1.8.19 from CRAN with R version 4.2.2 Patched

I installed with natmanager::install(pkgs = 'nat'), but still nothing. A quick reboot cleared that up and we're good to go with nat v1.10.4!

jefferis commented 1 year ago

Good to hear that you are up and running. Just a note for future reference that if you update a package that is already loaded then you must restart the R session to benefit from the update. Best, Greg.