knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

darklyplot

The goal of darklyplot is to create simple time series plots with a dark background. The miniminum and maximum values are highlighted, and color coded along with the y axis and x axis labels.

Installation

You can install the development version of darklyplot from GitHub with:

# install.packages("devtools")
devtools::install_github("lenkiefer/darklyplot")

Examples

This is a basic example which shows you how to solve a common problem:

library(darklyplot)
darklyplot(df=mtg_rate,column="rate",labelx="roundx",n.decimals=3)

You can vary the chart look with several parameters:

darklyplot(df=mtg_rate,
          column="rate",
          col="white",  #can use R color names or hex 
          n.decimals=0,
          refline=TRUE,
          refValue=5,
          refCol="purple",
          shade=TRUE,
          shadeCol="#fe5305",
          shadeAlpha=0.35,
          minCol="blue",
          maxCol="red",
          firstCol="orange",
          lastCol="pink",
          labelx="round",
          Ndodge=2)

This will work with any dataframe with a numeric column and a date index (named "date"):

set.seed(20200704)
df_test=data.frame(date=seq.Date(from=as.Date("2020-01-01"),to=as.Date("2020-06-30"),by="1 day"))
df_test$random_variable=rnorm(NROW(df_test),0,1)
darklyplot(df=df_test,column="random_variable",n.decimals=2)+labs(title="A Random Variable")


lenkiefer/darklyplot documentation built on July 4, 2020, 12:04 a.m.