I have a vega chart being generated in R by ggvis (see code below). I would like to make it so that the axes cross at 0,0 so there is no blank space between the area series and the axes.
Can this be done w/ ggvis? Can I do this within Vega?
library(ggvis)
tempDf <- data.frame(x=0:10,ymin=0,ymax=seq(from=1,to=0.3,len=11))
ggvis(data=tempDf,~x,~ymax,y2=~ymin) %>%
layer_ribbons(fill:="red") %>%
layer_lines(x=~x,y=~ymax,inherit=FALSE)
This can be set using the expand parameter in scale_numeric. Modified code below:
library(ggvis)
tempDf <- data.frame(x=0:10,ymin=0,ymax=seq(from=1,to=0.3,len=11))
ggvis(data=tempDf,~x,~ymax,y2=~ymin) %>%
layer_ribbons(fill:="red") %>%
layer_lines(x=~x,y=~ymax,inherit=FALSE) %>%
scale_numeric("x", expand = 0) %>%
scale_numeric("y", expand = 0)