stat_occurrence: Plots a time series as a dot plot

Description Usage Arguments Aesthetics Cosmetic Tips Examples

View source: R/stat_occurrence.R

Description

Plots a time series as a dot plot

Usage

1
2
stat_occurrence(mapping = NULL, data = NULL, show.legend = NA,
  inherit.aes = TRUE, na.rm = T, bandwidth = NULL, ...)

Arguments

mapping

mapping

data

df

show.legend

logical

inherit.aes

logical

na.rm

logical

bandwidth

bandwidth

...

more functions

For rare events, it's convenient to have the count of events encoded in the chart itself. A bar chart requires the user to perceive the y axis which this does not.

Aesthetics

x, y

Cosmetic Tips

The minimalist look can be achieved by appending the following chunk of code to the output object: + xlab(NULL) + ylab(NULL) + scale_fill_continuous(low = 'green', high = 'red') + theme( axis.text.y = element_blank(), axis.ticks.y = element_blank(), legend.position = 'none', strip.background = element_blank(), panel.background = element_blank(), panel.border = element_blank(), panel.grid = element_blank(), panel.border = element_blank() ) + coord_fixed(ylim = c(0,1 + max(dfData$y))) coord_fixed can provide a balance to the aspect ratio of the chart.

Examples

1
2
3
4
5
6
7
8
{
library(data.table)
library(ggplot2)
set.seed(1)
dfData = data.table(x = 1:100, y = floor(4 * abs(rnorm(100, 0 , 0.4))))
ggplot(dfData, aes(x =x, y = y) )+
   stat_occurrence()+
   coord_fixed()}

Example output

Loading required package: ggplot2

ggTimeSeries documentation built on Jan. 23, 2022, 5:07 p.m.