geom_rect() and geom_tile() do the same thing, but are parameterised differently: geom_rect() uses the locations of the four corners (xmin, xmax, ymin and ymax), while geom_tile() uses the center of the tile and its size (x, y, width, height). geom_raster() is a high performance special case for when all the tiles are the same size.
geom_raster({
"mapping" = null,
"data" = null,
"stat" = "identity",
"position" = "identity",
"...",
"hjust" = 0.5,
"vjust" = 0.5,
"interpolate" = false,
"na.rm" = false,
"show.legend" = NA,
"inherit.aes" = true
})
geom_rect({
"mapping" = null,
"data" = null,
"stat" = "identity",
"position" = "identity",
"...",
"linejoin" = "mitre",
"na.rm" = false,
"show.legend" = NA,
"inherit.aes" = true
})
geom_tile({
"mapping" = null,
"data" = null,
"stat" = "identity",
"position" = "identity",
"...",
"linejoin" = "mitre",
"na.rm" = false,
"show.legend" = NA,
"inherit.aes" = true
})
mapping |
Set of aesthetic mappings created by | |
---|---|---|
data |
The data to be displayed in this layer. There are three options: If NULL, the default, the data is inherited from the plot data as specified in the call to A data.frame, or other object, will override the plot data. All objects will be fortified to produce a data frame. See fortify() for which variables will be created. A function will be called with a single argument, the plot data. The return value must be a data.frame, and will be used as the layer data. A function can be created from a formula (e.g. ~ head(.x, 10)). | |
stat |
The statistical transformation to use on the data for this layer, as a string. | |
position |
Position adjustment, either as a string, or the result of a call to a position adjustment function. | |
... |
Other arguments passed on to | |
hjust, vjust |
horizontal and vertical justification of the grob. Each justification value should be a number between 0 and 1. Defaults to 0.5 for both, centering each pixel over its data location. | |
interpolate |
If TRUE interpolate linearly, if FALSE (the default) don't interpolate. | |
na.rm |
If FALSE, the default, missing values are removed with a warning. If TRUE, missing values are silently removed. | |
show.legend |
logical. Should this layer be included in the legends? NA, the default, includes if any aesthetics are mapped. FALSE never includes, and TRUE always includes. It can also be a named logical vector to finely select the aesthetics to display. | |
inherit.aes |
If FALSE, overrides the default aesthetics, rather than combining with them. This is most useful for helper functions that define both data and aesthetics and shouldn't inherit behaviour from the default plot specification, e.g. borders(). | |
linejoin |
Line join style (round, mitre, bevel). |
geom_tile() understands the following aesthetics (required aesthetics are in bold)
:
x
y
alpha
color
fill
group
height
linetype
size
width
Learn more about setting these aesthetics in vignette("cxplot-specs").
var cxp = new cxplot("canvas1", dsmall, aes("x", "y"));
cxp.geom_raster();