MyNixOS website logo
Description

Time Series Plot.

A fast and elegant time series visualization package. In addition to the standard R plot types, this package supports candle sticks, open-high-low-close, and volume plots. Useful for visualizing any time series data, e.g., stock prices and technical indicators.

rtsplot

Time series plot with base R Graphics

The rtsplot package is fast time series plot package with base R Graphics.

Installation:

The current release is available on CRAN, which you can install via:

install.packages("rtsplot")

To install the development version run following code:

remotes::install_bitbucket("rtsvizteam/rtsplot")
	

Example :

	library(quantmod)
	
	symbol = 'AAPL'
	data = getSymbols(symbol, src = 'yahoo',  auto.assign=F)
	
	library(rtsplot)
	y = data['2007::']
	sma = TTR::SMA(Cl(y), 250)
	rsi = TTR::RSI(Cl(y), 20)	

	# plot candles and volume and table
	layout(c(1,1,1,1,2,3))
	cols = rtsplot.colors(2)
		
	rtsplot(y, type = 'l', plotX = F, col=cols[1],lwd=1.5, log='y')
		rtsplot.lines(sma, col=cols[2], lwd=1.5)
		rtsplot.legend(c(symbol, 'SMA(250)'), cols[1:2], list(y,sma))
		
		
	y = rtsplot.scale.volume(y)
	rtsplot(y, type = 'volume', plotX = F, col = 'darkgray')
		rtsplot.legend('Volume', 'darkgray', Vo(y))
		
		
	# plot rsi
	rtsplot(rsi, type = 'l', ylim=c(0,100),
		y.highlight = c(c(0,30), c(70,100)),
		y.highlight.col = grDevices::adjustcolor(c('green','red'), 50/255)
	)	
	rtsplot.legend('RSI(20)', 'black', rsi)

plot of chunk plot-3

Example skip.breaks flag: skip plotting missing date/times (i.e. nights and weekends)

	library(rtsplot)
	
	# 'skip.breaks' example with daily data
	y = rtsplot.fake.stock.data(10, remove.non.trading = TRUE)
  
	layout(1:2)
	rtsplot(y, type='b')
		rtsplot.legend('skip.breaks=FALSE', text.col='red')
	rtsplot(y, type='b', skip.breaks=TRUE)
		rtsplot.legend('skip.breaks=TRUE', text.col='red')

plot of chunk plot-4

	# 'skip.breaks' example with intra-day data
	y = rtsplot.fake.stock.data(5*24*60, period = 'minute', remove.non.trading = TRUE)

	layout(1:2)
	rtsplot(y, type='l')
		rtsplot.legend('skip.breaks=FALSE', text.col='red')
	rtsplot(y, type='l', skip.breaks=TRUE)
		rtsplot.legend('skip.breaks=TRUE', text.col='red')

plot of chunk plot-4

Metadata

Version

0.1.5

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows