Controlling axes and legends
Besides making different plots with various layer types, one can control the axes and legends of a
ggvis plot. In this recipe, we demonstrate how to set the appearance properties of both axes and legends.
Ensure you have installed and loaded
ggvis into your R session. You also need to complete the previous steps by storing
house in your R environment.
How to do it…
Please perform the following steps to control axes and legends in
- First, we use the
add_axisfunction to control the axis orientation and label of a
> house %>% ggvis(~Size, ~Price) %>% layer_points() %>% + add_axis("x", title = "Real Estate Square Feet", orient="top") %>% + add_axis("y", title = "Real Estate Price", title_offset ...