ggseg / ggseg3d

ggseg3d R package for cisualising brain atlases through plotly
https://ggseg.github.io/ggseg3d/
Other
27 stars 9 forks source link

how to write the p value into ggseg3d #8

Closed wangkangcheng closed 3 years ago

wangkangcheng commented 3 years ago

Hi, After reading the usage of ggseg3d, I do not find the option for writing the p values into the function. Can you share your method of showing 3d subcortical view with p value?

thanks

ggseg3d( .data = NULL, atlas = "dk_3d", surface = "LCBC", hemisphere = c("right", "subcort"), label = "region", text = NULL, colour = "colour", palette = NULL, na.colour = "darkgrey", na.alpha = 1, show.legend = TRUE, options.legend = NULL )

library(ggseg3d) library(dplyr)

someData = data.frame( region = c("amygdala", "hippocampus", "thalamus proper","caudate", "putamen", "pallidum", "ventral DC"), p = sample(seq(0,.5,.001), 7), stringsAsFactors = FALSE)

ggseg3d(atlas = aseg_3d,na.alpha= .5) %>% add_glassbrain("left") %>% pan_camera("left lateral") %>% remove_axes()

drmowinckels commented 3 years ago

Hi!

THanks for testing out package. To alter the colour, change the column name for the colour argument to the name of the column that contains the p-values.

library(ggseg3d)
library(dplyr)

someData = data.frame(
  region = c("Left-Amygdala", "Left-Hippocampus", 
             "Left-Thalamus-Proper","Left-Caudate", 
             "Left-Putamen", "Left-Pallidum", "Left-VentralDC"),
  p = sample(seq(0,.5,.001), 7),
  stringsAsFactors = FALSE)

ggseg3d(.data = someData, 
        atlas = aseg_3d, 
        na.alpha= .5, 
        colour = "p") %>% 
  add_glassbrain("left") %>% 
  pan_camera("left lateral") %>% 
  remove_axes()

image

wangkangcheng commented 3 years ago

wow, cool picture, thanks. How to write the name of left-accumbens ? I try it with "Left-Accumbens-area". It reports no error. Does it right ?

Best

wangkangcheng commented 3 years ago

one more question about the colorbar:

dd = ggseg3d(.data = someData, atlas = aseg_3d, na.alpha= .5, colour = "p") %>% add_glassbrain("left") %>% pan_camera("left lateral") %>% remove_axes()

then, I try to change the colorbar and limit with the following command. It reports NULL. How can I update the command ? thanks dd + scale_fill_gradient2(low="blue",mid = "gray", high="red", limits=c(-2.5,3))

drmowinckels commented 3 years ago

You are trying to apply a ggplot2 scale to a plotly plot. ggseg3d is not based on ggplot (despite the name).

Please have a look at the user guides for how to use ggseg3d https://lcbc-uio.github.io/ggseg3d/articles/ggseg3d.html

wangkangcheng commented 3 years ago

thanks