fig_calendar: Calendar chart

Description Usage Arguments Value Note See Also Examples

View source: R/figure_calendar.R

Description

Plot time series data in calendar way.

Usage

1
2
3
4
5
fig_calendar(rawdata, colours = c("beige", "orange", "red", "darkred"),
  alpha = 0.8, na.col = "grey80", val.col = "grey70",
  mar.col = "grey80", mar.fill = "white", strip.text.size = 12,
  strip.text.hjust = 0, axis.x.size = 10, isfull = F, islegend = T,
  istext = F, text.size = 3, isday = F, day.size = 3)

Arguments

rawdata

A data.frame with two columns: 'dates', date data in the format of Date(); 'values', numeric data.

colours

A vector contains colours mapped to the figure.

alpha

Numeric value between 1 and 0, controls the transparency of rects.

na.col

Colour of the NA values.

val.col

Border colour of the rects.

mar.col

Border colour of the rects, which used to fill blank space.

mar.fill

Colour used to fill the rects, which used to fill black space.

strip.text.size

Text size of strip.

strip.text.hjust

Horizontal position of the text in strip.

axis.x.size

Text size of axis x.

isfull

Boolean value, default FALSE,if TRUE use rects fill the blank space.

islegend

Boolean value, default TRUE, if FALSE remove the legend.

istext

Boolean value, default False, if TRUE draw the value to the correspond date.

text.size

Text size of data value.

isday

Boolean value, default FALSE, if TRUE draw the date number.

day.size

Text size of date number.

Value

ggplot object

Note

istext and isday can only set one to be TRUE at one time.

See Also

Other figure: fig_bubble_rect, fig_event_line, fig_event_storm, fig_parallel

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# 1 month
rawdata <- data.frame(
  dates = seq(as.Date('2018-01-01'), length.out = 20, by = '1 day'),
  values = rnorm(20)
)
# fig_calendar(
#   rawdata,
#   na.col = 'grey90', val.col = 'grey80',
#   mar.fill = 'white', mar.col = 'grey80',
#   strip.text.size = 18, strip.text.hjust = 0.5,
#   axis.x.size = 12, isfull = TRUE, islegend = FALSE
# )

# 6 months
num <- 180
# rawdata <- data.frame(
#   dates = seq(as.Date('2018-01-01'), length.out = num, by = '1 day'),
#   values = round(rnorm(num), 3)
# )
# fig_calendar(rawdata, isfull = TRUE, na.col = 'grey80', val.col = 'grey80',
#              mar.fill = 'white', mar.col = 'grey80')

# add value tag
# fig_calendar(
#   rawdata,
#   na.col = 'grey90', val.col = 'grey80',
#   mar.fill = 'white', mar.col = 'grey80',
#   strip.text.size = 18, strip.text.hjust = 0.5,
#   axis.x.size = 12, isfull = TRUE, islegend = FALSE,
#   istext = TRUE
# )
#

purplezippo/ggpkt documentation built on May 21, 2019, 10:34 a.m.