twoAxisPlot: twoAxisPlot

Description Usage Arguments Value Examples

Description

twoAxisPlot plots two different y vectors to a single plot with two separate y-axes on the left and right of the plot.

Usage

1
2
twoAxisPlot(y1, y2, x1, x2, main, ylab1, ylab2, xlab, ylim1 = NULL,
  ylim2 = NULL, xBreaks = NULL, xLabels = NULL, legendNames)

Arguments

y1

Vector of y1

y2

Vector of y2

x1

Vector of x1

x2

Vector of x2 (if same x should be used for both, can just specify x1's vector a second time)

main

Main Title

ylab1

Y-axis label for y1

ylab2

Y-axis label for y2

xlab

X-axis label

ylim1

Upper and lower limits for y1

ylim2

Upper and lower limits for y2

xBreaks

Breaks for X-axis. If NULL, then all unique levels across x1 and x2 are used

xLabels

Labels for X-axis values. If NULL, then actual values are used.

legendNames

Names of y1 and y2 for legend

Value

Plot object printed to plots panel

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
x1 <- c(0, 35, 100, 300)
x2 <- c(0, 100, 300)
y1 <- c(10, 12, 16, 13)
y2 <- c(900, 850, 825)
twoAxisPlot(y1 = y1, y2 = y2, x1 = x1, x2 = x2,
            main = 'Example plot',
            ylab1 = 'Y Variable 1',
            ylab2 = 'Y Variable 2',
            xlab = 'X Variable',
            ylim1 = c(10, 20), ylim2 = c(800, 1000),
            xBreaks = NULL, xLabels = NULL,
            legendNames = c("Variable 1", "Variable 2"))

TaylorAndrew/atPlot documentation built on May 9, 2019, 4:23 p.m.