DualaxisLinechart function

DualaxisLinechart

DualaxisLinechart

A line chart with dual axisSS

DualaxisLinechart(X, Y1, Y2, xlab = "X", y1lab = "Y1", y2lab = "Y2", main = "Dual Axis Line Chart", cols = c("black", "blue"),Overlaying="y", SaveIt = FALSE)

Arguments

  • X: [1:n] vector, both lines require the same xvalues, e.g. the time of the time series, POSIXlt or POSIXct are accepted
  • Y1: [1:n] vector of first line
  • Y2: [1:n] vector of second line
  • xlab: Optional, string for xlabel
  • y1lab: Optional, string for first ylabel
  • y2lab: Optional, string for second ylabel
  • main: Optional, title of plot
  • cols: Optional, color of two lines
  • Overlaying: Change only default in case of using subplot
  • SaveIt: Optional, default FALSE; TRUE if you want to save plot as html in getwd() directory

Details

enables to visualize to lines in one plot overlaying them using ploty (e.g. two time series with two ranges of values)

Returns

plotly object

Author(s)

Michael Thrun

Examples

#subplot renames the numbering of subsequent plots y1=runif(100,0,1) y2=rnorm(100,m=5,s=1) DualaxisLinechart(1:100, y1, y2,main="Random Time series") y1=runif(100,0,1) y2=(1:100*3+4)*runif(100,0,1) p1=DualaxisLinechart(1:100, y1, y2,main="Random Time series",Overlaying="y2") y3=1:100*(-2)+4 y4=rnorm(100,m=0,s=2) p2=DualaxisLinechart(1:100, y3, y4,main="Random Time series",Overlaying="y4") plotly::subplot(p1,p2)