Description Usage Arguments Details Author(s) See Also Examples

Plot the columns of one matrix against the columns of another. Adds a legend on the right at the endpoints of lines.

1 2 3 4 |

`x, y` |
vectors or matrices of data for plotting. The number of rows should match. If one of them are missing, the other is taken as y and an x vector of |

`col` |
vector of colors. Colors are used cyclically. |

`lty, lwd, lend` |
vector of line types, widths, and end styles. The first element is for the first column, the second element for the second column, etc., even if lines are not plotted for all columns. Line types will be used cyclically until all plots are drawn. |

`xlab, ylab` |
titles for x and y axes, as in plot. |

`xlim, ylim` |
ranges of x and y axes, as in plot. |

`xaxt, yaxt` |
a character which specifies the x axis type. Specifying " |

`cex` |
character expansion factor relative to current |

`args.legend` |
list of additional arguments for the legend; names of the list are used as argument names. If set to NA, the legend will be suppressed. |

`main` |
an overall title for the plot. |

`grid` |
logical adds an nx by ny rectangular grid to an existing plot. |

`mar` |
the margins of the plot. |

`pch` |
character string or vector of 1-characters or integers for plotting characters, see |

`pch.col` |
vector of colors for the points. Colors are used cyclically. Ignored if |

`pch.bg` |
vector of background (fill) colors for the open plot symbols given by |

`pch.cex` |
vector of character expansion sizes, used cyclically. This works as a multiple of |

`...` |
the dots are sent to |

.

This function is rather a template, than a function. It wraps `matplot`

to generate a lines plot and adds a rather sophisticated legend on the right side, while calculating appropriate margins. A grid option is included (as `panel.first`

does not work in matplot).

As in matplot, the first column of x is plotted against the first column of y, the second column of x against the second column of y, etc. If one matrix has fewer columns, plotting will cycle back through the columns again. (In particular, either x or y may be a vector, against which all columns of the other argument will be plotted.)

Andri Signorell <andri@signorell.net>

1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ```
m <- matrix(c(3,4,5,1,5,4,2,6,2), nrow = 3,
dimnames = list(dose = c("A","B","C"),
age = c("2010","2011","2012")))
PlotLinesA(m, col=c(Pal("Helsana")), main="Dose ~ age_grp", lwd=3, ylim=c(1, 10))
# example from MASS
shoes <- list(
A = c(13.2, 8.2, 10.9, 14.3, 10.7, 6.6, 9.5, 10.8, 8.8, 13.3),
B = c(14, 8.8, 11.2, 14.2, 11.8, 6.4, 9.8, 11.3, 9.3, 13.6))
PlotLinesA(do.call(rbind, shoes), xlim=c(0.75,2.25), col=1, main="shoes",
pch=21, pch.bg="white", pch.col=1, pch.cex=1.5)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.