Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There's something wrong in my aseg code.. #97

Closed
lsmtgr opened this issue Feb 13, 2024 · 2 comments
Closed

There's something wrong in my aseg code.. #97

lsmtgr opened this issue Feb 13, 2024 · 2 comments

Comments

@lsmtgr
Copy link

lsmtgr commented Feb 13, 2024

Hello !
This is my R code

brain <- tibble( region = c("thalamus proper", "putamen", "caudate", "pallidum", "hippocampus",
"amygdala"),
p = c("0.00022", "0.0262", "0.000945", "8.6E-04", "6.3E-03", "0.006093"),
)

brainx <- brain %>% filter(p < 0.05)
ggplot(brainx) + geom_brain(atlas = aseg, side = "coronal", hemi = "left", aes(fill = p)) +
scale_fill_viridis_c(option = "cividis", direction = -1) +
theme_void() +
labs(title = "R basal")

image

"An error message similar to the image above appeared. What might be wrong?"

@drmowinckels
Copy link
Contributor

Hi!

The error message is saying that you are trying to apply a continuous scale to a discrete value.

You've entered the p values with quotes, meaning R thinks they are a categorical scale. Unquote your numbers and everything should be fine.

This is not a ggseg specific thing, but ggplot2.

https://stackoverflow.com/questions/29278153/plotting-with-ggplot2-error-discrete-value-supplied-to-continuous-scale-on-c

@lsmtgr
Copy link
Author

lsmtgr commented Feb 14, 2024

Thank you very much ! It works !!!!!!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants