ridgelineBy: Create Ridgeline Plots

Description Usage Arguments Value Examples

View source: R/ridgelineBy.R

Description

Generate density plots on the same graph, grouped by a dimension of choice

Usage

1
ridgelineBy(starsObj, attr, dim, plotTitle, y_reverse = FALSE, sd = TRUE, ...)

Arguments

starsObj

stars object

attr

attribute of interest

dim

grouping dimension

plotTitle

title of plot

y_reverse

should the y axis be reversed?

sd

if TRUE (the default), the range of the x axis is within three standard deviations of the mean, if FALSE the range of the x axis is the minimum and maximum of the attribute

...

arguments passed to scale_y_continuous() or scale_y_reverse()

Value

a gg or ggplot object

Examples

1
2
3
4
5
ridgelineBy(GISTEMP_Decadal, 1, 3, "Ridgeline", y_reverse = TRUE, breaks = seq(1970,2010,10))

# can subset stars objects by sf objects, such as countries from the rnaturalearth package
ridgelineBy(GISTEMP_Decadal[rnaturalearth::ne_countries(country = "Australia", returnclass = "sf")],
1, 3, "Australia Ridgeline", breaks = seq(1970,2010,10))

JamesMCollier/densityviz documentation built on Dec. 18, 2021, 12:31 a.m.