metR (version 0.6.0)

DivideTimeseries: Divides long timeseries for better reading

Description

Long timeseries can be compressed to the point of being unreadable when plotted on a page. This function takes a ggplot object of a timeseries and divides it into panels so that the time dimension gets stretched for better readability.

Usage

DivideTimeseries(g, x, n = 2, xlab = "x", ylab = "y")

Arguments

g

ggplot object

x

The vector that was used in g for the x axis (must be of class Date)

n

Number of panels

xlab

x axis label

ylab

y axis label

Value

Draws a plot.

See Also

Other ggplot2 helpers: MakeBreaks(), WrapCircular(), geom_arrow(), geom_contour2(), geom_contour_fill(), geom_label_contour(), geom_relief(), geom_streamline(), guide_colourstrip(), map_labels, reverselog_trans(), scale_divergent, scale_longitude, stat_na(), stat_subset()

Examples

Run this code
# NOT RUN {
library(ggplot2)
library(data.table)
gdata <- geopotential[lat == -30 & lon == 0]
g <- ggplot(gdata, aes(date, gh)) +
    geom_line() +
    geom_smooth() +
    scale_x_date(date_breaks = "1 year", date_labels = "%b")
DivideTimeseries(g, gdata$date, n = 2, "Date", "Max Temperature")
# }

Run the code above in your browser using DataLab