dual_plot: Plotting of 2 series with a secondary Y axis

Description Usage Arguments Value Examples

Description

dual_plot will take 2 series and plot the second series on the second Y-axis

Usage

1
2
3
4
5
6
dual_plot(x1 = time(y1), y1, y2, x2 = x1, col1 = "#C54E6D",
  col2 = "#009380", lwd = 1, colgrid = NULL, mar = c(3, 6, 3, 6) + 0.1,
  ylab1 = substitute(y1), ylab2 = substitute(y2), nxbreaks = 5,
  yleg1 = paste(ylab1, "(LHS)"), yleg2 = paste(ylab2, "(RHS)"),
  ylim1 = NULL, ylim2 = NULL, ylim.ref = 1, xlab = "", main = NULL,
  legx = "topleft", legy = NULL, ...)

Arguments

x1

x-axis object

y1, y2

objects to be plotted

col1, col2

colors for the 2 lines

lwd

line width

colgrid

colour of gridlines; if NULL there are no gridlines

mar

margins for plotting area see (see ?par)

ylab1, ylab2

labels for the two y axes

yleg1, yleg2

legend of the 2 objects

legx, legy

position of the legend

nbreaks

Number of breaks in horizontal axis

Value

Plot of 2 series on different Y-axis

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
data("forex")

with(forex, dual_plot(x1 = TimePeriod, y1 = NZDUSD, y2 = TWI, lwd = 1.2, colgrid = "grey90", 
    main = "NZ dollar exchange rate & trade-weighted index",
    ylab1 = "NZ dollars for one US dollar",
    ylab2 = "Index",
    yleg1 = "NZD / USD exchange rate (left axis)",
    yleg2 = "Trade-weighted index (right axis)",
    mar = c(5,6,3,6)))
    
mtext(side = 1, "Data from RBNZ", 
          adj = 1, cex = 0.8, line = 3)
          

HanjoStudy/quotidieR documentation built on May 5, 2019, 6:13 p.m.