Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

boxplot won't display with ggvis

Tags:

plot

r

ggvis

I'm trying to make a boxplot with ggvis and I can't seem to view one even with a simple example

library(dplyr)
library(ggplot2)
library(shiny) #I think this is required? not sure
data.frame(theVar = c(1,5:10,15)) %>% ggvis(x = ~theVar) #makes a histogram

data.frame(theVar = c(1,5:10,15)) %>% ggvis(x = ~theVar) %>% layer_boxplots()

Error: Can't find prop y.update

forcing a y variable:

data.frame(theVar = c(1,5:10,15)) %>% ggvis(x = ~theVar,y=~theVar) %>% layer_boxplots()

seems to turn it into intervals? not sure what its doing but it's not a boxplot, nor should a boxplot need an X and Y...

like image 395
hedgedandlevered Avatar asked Jun 11 '26 08:06

hedgedandlevered


1 Answers

If you have a single variable, you have to use your variable for y and specify a dummy for x:

library(ggvis)
data.frame(theVar = c(1,5:10,15)) %>% ggvis(y = ~theVar, x = ~ 1) %>% layer_boxplots()
like image 187
Sven Hohenstein Avatar answered Jun 14 '26 06:06

Sven Hohenstein



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!