Description Usage Arguments Value Author(s) Examples
Function generate (non-)facetted lineplot
1 2 3 4 |
data |
A data frame in long format (Required) |
by |
Variable the plot should be facetted by (Default: NULL) |
facet.rows |
Number of rows in which the facets should be displayed. (Default: 1) |
upper.err |
Upper bound width on errorbars or ribbon variability region (Default: 1) |
lower.err |
Lower bound width on errorbars or ribbon variability region (Default: 1) |
var.type |
Type of how to display variability ("errorbar", "ribbon") (Default: "errorbar") |
title |
Title of the plot (Default: NULL) |
xlab |
x-axis label (Default: NULL) |
ylab |
y-axis label (Default: NULL) |
xlim |
Upper and lower limit (e.g. c(0, 10)) of x-axis (Default: NULL) |
ylim |
Upper and lower limit (e.g. c(0, 10)) of y-axis (Default: NULL) |
legend.position |
Position of the legend ("none", "left", "right", "top", "bottom") (Default: "left") |
size |
Point Size (Default: 3) |
x.log10trans |
Logical flag for log10 x-axis trasformation |
y.log10trans |
Logical flag for log10 y-axis trasformation |
a ggplot2 plot
Jens Hooge
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | ## Not run:
library(reshape2)
library(ggplot2)
n=7
df <- data.frame(Dose1=exp((1/2)*1:n),
Dose2=exp((1/3)*1:n),
Dose3=exp((1/4)*1:n),
Dose4=exp((1/5)*1:n),
Dose5=exp((1/6)*1:n),
Dose6=exp((1/7)*1:n),
Visit=1:n)
df <- melt(df, id=c("Visit"))
colnames(df) <- c("Visit", "Dose", "Measure")
## Lineplot with Errorbars
general.lineplot(df, upper.err=1, lower.err=1, var.type="errorbar")
## Lineplot with Errorbars and log transformed y axis
general.lineplot(df, upper.err=1, lower.err=1, var.type="errorbar", y.log10trans = T)
## Facetted Lineplot
general.lineplot(df, by="Dose", facet.row=3, upper.err=1, lower.err=1,
var.type="errorbar", y.log10trans = T)
## Lineplot with Error Ribbon
general.lineplot(df, by="Dose", upper.err=1, lower.err=1, var.type="ribbon")
## Lineplot with Error Ribbon and log transformed y-axis
general.lineplot(df, by="Dose", upper.err=1, lower.err=1, var.type="ribbon", y.log10trans = T)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.