View source: R/utility_plotgeometry.R
ggplot_add_watermarker | R Documentation |
Adds a standard water table marker (upside-down triangle over a number of horizontal lines) to an existing ggplot
ggplot_add_watermarker( plt, xc, yc, theta = 0, scale = 1, linesize = 0.5, fill_water = "#2a7fff", colour_water = "#000080" )
plt |
ggplot object |
xc, yc |
x and y-position where marker touches water table |
theta |
rotation angle (in case label needs to be rotated, in rad) |
scale |
scaling factor for marker. Default height is approx 1 |
linesize |
thickness of lines |
fill_water |
fill colour for triangle |
colour_water |
line colour for all lines |
ggplot object with added water table marker
#generate simple plot plt <- ggplot2::ggplot() + ggplot2::annotate("rect", xmin = -2, xmax = 2, ymin = -2, ymax = 2, fill = "yellow") + ggplot2::coord_fixed(ratio = 1) #add water table marker ggplot_add_watermarker(plt, x = 1, y = 1, scale = 1, theta = 0.4)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.