I am looking for the best way to enhance a chart
library(dplyr)
library(ggvis)
df <- data.frame(Year=c(1954:2013), Count=rep(as.integer(c(1,3,4,2)),15))
This can be done using the format=
in the add_axis
along with subdivide
argument -
A subdivide = 0
means no minor ticks between major ticks (defined in values
). The format='####'
makes everything whole numbers.
df %>%
ggvis(~Year,~Count) %>%
layer_points() %>%
add_axis("x", title="Year", format="####") %>%
add_axis("y", subdivide = 0, values = seq(1, 4, by = 1), format='####')
which gives: