Description Usage Arguments Details Value Author(s) Examples
These functions provide ways to modify the palettes, variables to create
aesthetics and their titles in a data object created by qdata.
Currently supported aesthetics are about color, border and size of graphical
elements.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
data |
the data object |
value |
the palette (as a function mapping a data variable to graphical properties), the variable name (as a character scalar), or the title (as a character scalar) |
All these information is called “scales” (in the ggplot2 term) and
stored in attr(data, 'Scales'). Usually palette functions are from the
scales package.
The corresponding scale information in data is set to
value.
Yihui Xie <http://yihui.name>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | library(cranvas)
library(scales)
qtennis <- qdata(tennis, color = aces)
qscatter(server.pts, first.serves, data = qtennis)
qparallel(10:14, data = qtennis) # variables including Aces
qscatter(server.pts, aces, data = qtennis)
## now notice the color changes in the plot
color_pal(qtennis) <- div_gradient_pal() # change to diverging gradient palette
color_var(qtennis) <- "first.serves" # change color variable from Aces to First.Serves
color_title(qtennis) <- "First Serves" # change title; to be used in legend
cranvas_off()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.