Learn R Programming

ethiodate (version 0.3.1)

ethdate-ggplot: 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")

Value

Maps ethdate objects on ggplot2 layers.

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.

Author

Gutama Girja Urago

Details

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

Examples

Run this code

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()

Run the code above in your browser using DataLab