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.
Getting ready
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 ggvis
:
- First, we use the
add_axis
function to control the axis orientation and label of aggvis
plot:> 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 ...
Get R for Data Science Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.