
How it works...
After running step 1, a new function named ggvis_title() is available in the environment. Four arguments are named, two with default values. Additionally, there is ellipsis (...), meaning that more arguments can be added if named. Feel free to modify and adapt this function to better fit your needs.
The object inputted with the function function() (kek) holds the new function name. Inside the parenthesis come the arguments: first one must be vis, so that the chaining process through the pipes keeps working, and then next comes plot_title. This last arguments has no default value and it may be declared with a string that will go into title.
Subsequent arguments are title_size and shift, both with default values. The first one adjusts the title size, while the second one shifts the title towards the top whenever inputted with positive values and shifts it down if the values inputted are negative.
Only naming arguments won't do it. We need to work those arguments inside ggvis::add_axis() function so that we get an invisible extra axis with a visible title. Also we make sure to not have any grid coming from this axis, neither visible ticks and labels.
There are two things to outline in step 2. One is the guessing process. Once we did not called for any geometry, ggvis is guessing layer_points() (point geometry). Two, the title was successfully added. Next, we are going to explore more about scatterplots. Just for a moment, let's forget about labels and titles, and focus on how we can have multiple colors and shapes altogether.