| geom-docs | R Documentation |
All geoms in this package are identical to their counterparts in ggplot2 except that they can be filled with patterns.
geom_rect_pattern(
mapping = NULL,
data = NULL,
stat = "identity",
position = "identity",
...,
lineend = "butt",
linejoin = "mitre",
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE
)
geom_bar_pattern(
mapping = NULL,
data = NULL,
stat = "count",
position = "stack",
...,
just = 0.5,
lineend = "butt",
linejoin = "mitre",
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE
)
geom_tile_pattern(
mapping = NULL,
data = NULL,
stat = "identity",
position = "identity",
...,
lineend = "butt",
linejoin = "mitre",
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE
)
geom_bin_2d_pattern(
mapping = NULL,
data = NULL,
stat = "bin2d",
position = "identity",
...,
lineend = "butt",
linejoin = "mitre",
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE
)
geom_bin2d_pattern(
mapping = NULL,
data = NULL,
stat = "bin2d",
position = "identity",
...,
lineend = "butt",
linejoin = "mitre",
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE
)
geom_boxplot_pattern(
mapping = NULL,
data = NULL,
stat = "boxplot",
position = "dodge2",
...,
outliers = TRUE,
outlier.colour = NULL,
outlier.color = NULL,
outlier.fill = NULL,
outlier.shape = NULL,
outlier.size = NULL,
outlier.stroke = 0.5,
outlier.alpha = NULL,
whisker.colour = NULL,
whisker.color = NULL,
whisker.linetype = NULL,
whisker.linewidth = NULL,
staple.colour = NULL,
staple.color = NULL,
staple.linetype = NULL,
staple.linewidth = NULL,
median.colour = NULL,
median.color = NULL,
median.linetype = NULL,
median.linewidth = NULL,
box.colour = NULL,
box.color = NULL,
box.linetype = NULL,
box.linewidth = NULL,
notch = FALSE,
notchwidth = 0.5,
staplewidth = 0,
varwidth = FALSE,
na.rm = FALSE,
orientation = NA,
show.legend = NA,
inherit.aes = TRUE
)
geom_col_pattern(
mapping = NULL,
data = NULL,
stat = "identity",
position = "stack",
...,
just = 0.5,
lineend = "butt",
linejoin = "mitre",
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE
)
geom_crossbar_pattern(
mapping = NULL,
data = NULL,
stat = "identity",
position = "identity",
...,
middle.colour = NULL,
middle.color = NULL,
middle.linetype = NULL,
middle.linewidth = NULL,
box.colour = NULL,
box.color = NULL,
box.linetype = NULL,
box.linewidth = NULL,
fatten = deprecated(),
na.rm = FALSE,
orientation = NA,
show.legend = NA,
inherit.aes = TRUE
)
geom_ribbon_pattern(
mapping = NULL,
data = NULL,
stat = "identity",
position = "identity",
...,
orientation = NA,
lineend = "butt",
linejoin = "round",
linemitre = 10,
outline.type = "both",
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE
)
geom_area_pattern(
mapping = NULL,
data = NULL,
stat = "align",
position = "stack",
...,
orientation = NA,
outline.type = "upper",
lineend = "butt",
linejoin = "round",
linemitre = 10,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE
)
geom_density_pattern(
mapping = NULL,
data = NULL,
stat = "density",
position = "identity",
...,
outline.type = "upper",
lineend = "butt",
linejoin = "round",
linemitre = 10,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE
)
geom_histogram_pattern(
mapping = NULL,
data = NULL,
stat = "bin",
position = "stack",
...,
binwidth = NULL,
bins = NULL,
orientation = NA,
lineend = "butt",
linejoin = "mitre",
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE
)
geom_polygon_pattern(
mapping = NULL,
data = NULL,
stat = "identity",
position = "identity",
...,
rule = "evenodd",
lineend = "butt",
linejoin = "round",
linemitre = 10,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE
)
geom_map_pattern(
mapping = NULL,
data = NULL,
stat = "identity",
...,
map,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE
)
geom_sf_pattern(
mapping = aes(),
data = NULL,
stat = "sf",
position = "identity",
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE,
...
)
geom_violin_pattern(
mapping = NULL,
data = NULL,
stat = "ydensity",
position = "dodge",
...,
trim = TRUE,
bounds = c(-Inf, Inf),
quantile.colour = NULL,
quantile.color = NULL,
quantile.linetype = 0L,
quantile.linewidth = NULL,
draw_quantiles = deprecated(),
scale = "area",
na.rm = FALSE,
orientation = NA,
show.legend = NA,
inherit.aes = TRUE
)
A ggplot2::Geom object.
Not all arguments apply to all patterns.
patternPattern name string e.g. 'stripe' (default), 'crosshatch', 'point', 'circle', 'none'
pattern_alphaAlpha transparency for pattern. default: 1
pattern_angleOrientation of the pattern in degrees. default: 30
pattern_aspect_ratioAspect ratio adjustment.
pattern_colourColour used for strokes and points. default: 'black'
pattern_densityApproximate fill fraction of the pattern. Usually in range [0, 1], but can be higher. default: 0.2
pattern_filenameImage filename/URL.
pattern_fill Fill colour (or grid::pattern()/gradient fill). default: 'grey80'
pattern_fill2 Second fill colour (or grid::pattern()/gradient fill). default: '#4169E1'
pattern_filter(Image scaling) filter. default: 'lanczos'
pattern_frequencyFrequency. default: 0.1
pattern_gravityImage placement. default: 'center'
pattern_gridPattern grid type. default: 'square'
pattern_key_scale_factorScale factor for pattern in legend. default: 1
pattern_linetypeStroke linetype. default: 1
pattern_option_1Generic user value for custom patterns.
pattern_option_2Generic user value for custom patterns.
pattern_option_3Generic user value for custom patterns.
pattern_option_4Generic user value for custom patterns.
pattern_option_5Generic user value for custom patterns.
pattern_orientation'vertical', 'horizontal', or 'radial'. default: 'vertical'
pattern_resPattern resolution (pixels per inch).
pattern_rotRotation angle (shape within pattern). default: 0
pattern_scaleScale. default: 1
pattern_shapePlotting shape. default: 1
pattern_sizeStroke line width. default: 1
pattern_spacingSpacing of the pattern as a fraction of the plot size. default: 0.05
pattern_typeGeneric control option
pattern_subtypeGeneric control option
pattern_xoffsetOffset the origin of the pattern. Range [0, 1]. default: 0. Use this to slightly shift the origin of the pattern. For most patterns, the user should limit the offset value to be less than the pattern spacing.
pattern_yoffsetOffset the origin of the pattern. Range [0, 1]. default: 0. Use this to slightly shift the origin of the pattern. For most patterns, the user should limit the offset value to be less than the pattern spacing.
if (require("ggplot2")) {
# 'stripe' pattern example
df <- data.frame(level = c("a", "b", "c", 'd'), outcome = c(2.3, 1.9, 3.2, 1))
gg <- ggplot(df) +
geom_col_pattern(
aes(level, outcome, pattern_fill = level),
pattern = 'stripe',
fill = 'white',
colour = 'black'
) +
theme_bw(18) +
theme(legend.position = 'none') +
labs(
title = "ggpattern::geom_col_pattern()",
subtitle = "pattern = 'stripe'"
)
plot(gg)
# 'pch' pattern example
gg <- ggplot(mtcars, aes(as.factor(cyl), mpg)) +
geom_violin_pattern(aes(fill = as.factor(cyl),
pattern_shape = as.factor(cyl)),
pattern = 'pch',
pattern_density = 0.3,
pattern_angle = 0,
colour = 'black'
) +
theme_bw(18) +
theme(legend.position = 'none') +
labs(
title = "ggpattern::geom_violin_pattern()",
subtitle = "pattern = 'pch'"
)
plot(gg)
# 'polygon_tiling' pattern example
gg <- ggplot(mtcars) +
geom_density_pattern(
aes(
x = mpg,
pattern_fill = as.factor(cyl),
pattern_type = as.factor(cyl)
),
pattern = 'polygon_tiling',
pattern_key_scale_factor = 1.2
) +
scale_pattern_type_manual(values = c("hexagonal", "rhombille",
"pythagorean")) +
theme_bw(18) +
theme(legend.key.size = unit(2, 'cm')) +
labs(
title = "ggpattern::geom_density_pattern()",
subtitle = "pattern = 'polygon_tiling'"
)
plot(gg)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.