ethdate-ggplot {ethiodate}R Documentation

Plotting Ethiopian Date

Description

Helper functions to plot an ethdate object using ggplot2.

Usage

scale_x_ethdate(breaks = eth_breaks(), labels = eth_labels(), ...)

scale_y_ethdate(breaks = eth_breaks(), labels = eth_labels(), ...)

eth_breaks(n = 5, pretty = TRUE)

eth_labels(format = "%b %d, %Y", lang = "lat")

Arguments

breaks

A numeric vector of positions or eth_breaks() function.

labels

A character vector giving labels (must be same length as breaks) or eth_labels() function.

...

further arguments to be passed to ggplot2::scale_x_continuous() or ggplot2::scale_y_continuous().

n

A number of breaks.

pretty

Logical; if TRUE, use pretty() for rounded breaks.

format

A format for the ethdate.

lang

A language for the month or weekday names if involved. Use "lat" for Latin alphabets "amh" for Amharic alphabets, and "en" for English names.

Details

eth_labels() and eth_breaks() are designed to be used only in the ⁠scale_(x|y)_ethdate⁠ functions.

Value

Maps ethdate objects on ggplot2 layers.

Author(s)

Gutama Girja Urago

Examples


library(ggplot2)

cpieth[["ethdt"]] <- eth_date(cpieth$date)

ggplot(cpieth, aes(ethdt, cpi)) +
  geom_line() +
  scale_x_ethdate(breaks = eth_breaks(6),
                  labels = eth_labels("%Y"),
                  name = "Year (EC)") +
  theme_bw()

[Package ethiodate version 0.2.0 Index]