ggplot()
initializes a ggplot object. It can be used to
declare the input data frame for a graphic and to specify the
set of plot aesthetics intended to be common throughout all
subsequent layers unless specifically overridden.Reports whether x is a ggplot object
Draw plot on current graphics device.
ggplot(data = NULL, mapping = aes(), ..., environment = parent.frame())plot_clone(plot)
is.ggplot(x)
## S3 method for class 'ggplot':
print(x, newpage = is.null(vp), vp = NULL, ...)
## S3 method for class 'ggplot':
plot(x, newpage = is.null(vp), vp = NULL, ...)
fortify
. If not specified,
must be suppled in each layer added to the plot.ggplot()
is called.ggplot_build
, which
is a list with components that contain the plot itself, the data,
information about the scales, panels etc.ggplot()
is typically used to construct a plot
incrementally, using the + operator to add layers to the
existing ggplot object. This is advantageous in that the
code is explicit about which layers are added and the order
in which they are added. For complex graphics with multiple
layers, initialization with ggplot
is recommended.There are three common ways to invoke ggplot
:
ggplot(df, aes(x, y, ))
ggplot(df)
ggplot()
ggplot
object which
is fleshed out as layers are added. This method is useful when
multiple data frames are used to produce different layers, as
is often the case in complex graphics.