scale_y_continuous_hdx {gghdx}R Documentation

Position scales for continuous y data

Description

scale_y_continuous_hdx() and the three variants with different trans arguments are defaults scales for the y axis that ensures the distance from data to the y-axis is reduced to 0, as is common throughout the HDX data visualization guidelines. This is done by setting expand = c(0, 0).

Usage

scale_y_continuous_hdx(...)

scale_y_log10_hdx(...)

scale_y_reverse_hdx(...)

scale_y_sqrt_hdx(...)

Arguments

...

Other arguments pass on to ggplot2::scale_y_continuous().

Details

For simple manipulation of labels and limits, you may wish to use labs() and lims() instead.

Value

ggplot2::ScaleContinuousPosition object to scale a ggplot2::ggplot() plot.

Examples

library(ggplot2)

p <- ggplot(df_covid) +
  geom_line(
    aes(
      x = date,
      y = cases_monthly
    )
  )

p

# start y axis at 0
p + scale_y_continuous_hdx()
p + scale_y_log10_hdx()


[Package gghdx version 0.1.3 Index]