Description Usage Arguments Author(s) Examples
With skewed data, important relationships are often scaled so small because the graph attempts to capture the outliers.
scaleBreak
will plot two different scales on the same plot, shrinking the range where the outliers lay. The break
in scale is indicated with a mark.
1 | scaleBreak(x, y, axis = 2, breakpos = 1, plot.numbers = c(1, 2), ...)
|
x |
The x variables to be plotted. |
y |
The y variables to be plotted. |
axis |
Which axis should have two different scales. Currently, only implemented for "2," which is the y axis. |
breakpos |
At what point should the break occur? Defaults to 1. |
plot.numbers |
Which plots to include. Can be 1, 2, or c(1,2). |
... |
other arguments passed to plot |
Dustin Fife
1 2 3 4 5 6 7 8 9 10 11 12 13 | # generate correlated data
d = data.frame(mvrnorm(1000, mu=c(0,0), Sigma=matrix(c(1,.6,.6,1), nrow=2)))
names(d) = c("x","y")
## Skew Y
d$y = d$y^2
scaleBreak(d$x, d$y, breakpos=4, plot.numbers=1)
## add a lowess line
lines(lowess(d$x, d$y), col="red")
## add a fitted line
mod = glm(y~x, data=d, family=inverse.gaussian)
curve(predict(mod,data.frame(x=x),type="resp"),add=TRUE,col="blue")
## add second plot
scaleBreak(d$x, d$y, breakpos=4, plot.numbers=2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.