this is quite simple but I was not able to find a solution. How can I make a line in layers_lines dashed in ggvis. I'm dealing with a custom type of linear regression and I provide this toy example for my problem:
library(ggvis)
W=seq(0,10,0.1)
data=data.frame(fit=3+2*W,upper=4+2*W,lower=2+2*W)
base <- data %>% ggvis(x= ~fit,y= ~W)%>%layer_lines() %>%
layer_lines(x= ~lower,y= ~W)%>%layer_lines(x= ~upper,y= ~W)
This produces this image:
I want the upper and the lower lines to be dashed. Thank you so much for the help!
It definitely helps to brush up on Vega to use ggvis. You need to use the strokeDash
property.
library(ggvis)
W <- seq(0, 10, 0.1)
data <- data.frame(fit=3+2*W, upper=4+2*W, lower=2+2*W)
data %>%
ggvis(x= ~fit, y= ~W) %>%
layer_lines() %>%
layer_lines(x= ~lower, y= ~W, strokeDash:=6) %>%
layer_lines(x= ~upper, y= ~W, strokeDash:=6) -> base
base