ethdate-ggplot | R Documentation |
Helper functions to plot an ethdate
object using ggplot2
.
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")
breaks |
A numeric vector of positions or |
labels |
A character vector giving labels (must be same length as breaks) or
|
... |
further arguments to be passed to |
n |
A number of breaks. |
pretty |
Logical; if TRUE, use pretty() for rounded breaks. |
format |
A format for the |
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. |
eth_labels()
and eth_breaks()
are designed to be used only in the scale_(x|y)_ethdate
functions.
Maps ethdate
objects on ggplot2
layers.
Gutama Girja Urago
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()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.