layer_barchart.Rd
layer_barchart
layer_barchart(
mapping = NULL,
data = NULL,
brks,
cols,
x = 0,
y = 0,
width = unit(0.5, "npc"),
height = unit(0.5, "npc"),
just = c(0, 0),
fontsize = 12,
theme = NULL,
...
)
geom_barchart(
mapping = NULL,
data = NULL,
brks,
cols,
x = 0,
y = 0,
width = unit(0.5, "npc"),
height = unit(0.5, "npc"),
just = c(0, 0),
fontsize = 12,
theme = NULL,
...
)
Set of aesthetic mappings created by aes()
. If specified and
inherit.aes = TRUE
(the default), it is combined with the default mapping
at the top level of the plot. You must supply mapping
if there is no plot
mapping.
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 ggplot()
.
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)
).
A numeric vector or unit object specifying x-location.
A numeric vector or unit object specifying y-location.
Bar width. By default, set to 90% of the resolution()
of the
data.
A numeric vector or unit object specifying height.
Adjustment for column placement. Set to 0.5
by default, meaning
that columns will be centered about axis breaks. Set to 0
or 1
to place
columns to the left/right of axis breaks. Note that this argument may have
unintended behaviour when used with alternative positions, e.g.
position_dodge()
.
Other arguments passed on to layer()
. These are
often aesthetics, used to set an aesthetic to a fixed value, like
colour = "red"
or size = 3
. They may also be parameters
to the paired geom/stat.
library(gg.layers)
library(ggplot2)
library(rcolors)
data("d_trendPerc")
d_mask <- mutate(d_trendPerc, mask = perc <= 0.99) # %>% as.data.frame()
brks = seq(0.9, 1, 0.025)
nbrk = length(brks) - 1
cols <- get_color(rcolors$amwg256, nbrk)
# the part of not significant
ggplot(data = d_mask, aes(x, y)) +
geom_raster(aes(fill = perc)) +
layer_barchart(aes(z = perc),
width = unit(0.3, "npc"),
height = unit(0.3, "npc"),
brks = brks, cols = cols)