Description Usage Arguments Value Examples
This function generates a single plot with multiple lines of rainbow colors, given a list of matrices(or data frames).
1 2 3 |
mat.list |
a list of two-column matrices or two-column data frames. |
samplenames |
a vector of names that will be used as the legend.text. The length of samplenames must be the same. If not specified, the names of mat.list will be used. Defaults to NULL. |
color |
a vector of colors that will be used for the plots. The length of color must be the same as the length of mat.list. If not specified, rainbow colors will be used automatically. Defaults to NULL. |
lty |
line type. |
lwd |
line width. |
xlab |
x-axis label. Defaults to 'x'. |
ylab |
y-axis label. Defaults to 'y'. |
main |
title. Defaults to ”. |
cex.legend |
the cex of the legend. Reduce this if you run out of vertical space for legend. Defaults to 1. |
template1.args |
list of parameters for template1(), such as legend.plt.x. |
add.func |
an additional function to add to the plot (eg. abline). |
... |
other graphical parameters. |
a vector of colors used.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ## example of three plots
par(mfrow=c(3,1))
# plot 1
mat.list = list("sd=1"=cumhist(rnorm(1000),plot=FALSE),"sd=2"=cumhist(rnorm(2000,sd=2),plot=FALSE))
plot_rainbowlines(mat.list)
# plot 2
plot_rainbowlines(mat.list,c("sd=1","sd=2"),color=c("violet","dodgerblue"),ylab="Cumulative fraction",main="Gaussian",lwd=2)
# plot 3
mat.list = lapply(1:10, function(sd) cumhist(rnorm(10000,sd=sd),plot=FALSE) )
legend.text = paste("sd=",1:10,sep="")
plot_rainbowlines(mat.list,legend.text,x="values",ylab="Cumulative fraction",main="Gaussian",template1.args=list(legend.plt.x=0.8),add.func=function(){abline(h=0.5,lty=2)})
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.