October 2012
Beginner to intermediate
721 pages
21h 38m
English
As we saw above, the simplest way to use ggplot2 is with the qplot command:
qplot(x, y, ..., data, facets, margins, geom, stat, position, xlim, ylim, log, main, xlab, ylab
qplot is designed to pick default
values that produce a readable plot (and uses helper functions to help
make those choices based on the inputs data), but you can control how
qplot works. Here is a description of
the arguments to qplot:
| Argument | Description | Default |
|---|---|---|
| x | X values. | |
| y | Y values. | NULL |
| data | (Optional) Data frame in which x and y are defined. | |
| facets | Describes facets to use as a formula. Uses facet_wrap for one-sided formula or
facet_grid for a two sided
formula. | NULL |
| margins | Enables displaying margins. | FALSE |
| geom | Specifies the geom to
use as a vector of character values. | "auto" If x and y
are specified, defaults to If only x is
specified, defaults to |
| stat | Specifies statistics to use as a vector of character values. | list(NULL) |
| position | Specifies position adjustments. | list(NULL) |
| xlim | Limits for x-axis, as a vector of two values. | c(NA,NA) |
| ylim | Limits for y-axis, as a vector of two values. | c(NA,NA) |
| log | Specifies whether to display x-axis, y-axis, or both in log
scale. Use "" for neither,
"x" for just the x-axis,
"y" for just the y-axis, and
"xy" for both. | "" |
| main | The title for the plot as a character values. | NULL |
| xlab | The label for the x-axis. | deparse(substitute(x)) |
| ylab | The label for the y-axis. | deparse(substitute(y)) |
| asp | The y/x aspect
ratio. | NA |
| ... | Other aesthetic attributes passed to lower layers. |