lineChartDf: Plot data using a plotting data frame

Description Usage Arguments Details Examples

View source: R/LineChart-functions.R

Description

This function uses a data frame with the same format as one created by createPlottingDf. This is mainly an internal function that is called by lineChart, but it can be called directly if more control of plotDf is desired.

Usage

1
2
3
lineChartDf(plotDf, title = "", xlab = NULL, ylab = NULL, ylim = NULL,
  xlim = NULL, plotXAxis = TRUE, plotYAxis = TRUE, lwd.axes = par()$lwd,
  add = FALSE)

Arguments

plotDf

The data frame to plotted.

title

The title to place at the top of the plot.

xlab

The label to place on the x-axis. If NULL (default), the name of the source of data for the x-variable will be used, if available.

ylab

The label to place on the y-axis. If NULL (default), the name of the source of data for the y-variable will be used if available.

ylim

The plotting range of the y-axis.

xlim

The plotting range of the x-axis.

plotXAxis

Should the x-axis be plotted?

plotYAxis

Should the y-axis be plotted?

lwd.axes

The line width of the axes and box around the plotting area.

add

If FALSE, a new plot will be started and the data plotted in it. If TRUE, the data will be plotted in the current plotting device, if any.

Details

If xlab and/or ylab are NULL, the original names of the source of the data are used for plotting, if available. The original names are stored in attributes and sometimes attributes are lost or, in the case of a manually created plotting data frame, not present. The original names are stored in an attribute called "originalNames" which is a list with "y", "x", and "group" components.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
data(ChickWeight)
#Use just a subset of the data
ChickWeight = ChickWeight[ ChickWeight$Diet %in% c(1, 3), ]

plotDf = createPlottingDf(weight ~ Time * Diet, ChickWeight, errBarType="SD")

#Make single-sided error bars, using the standard deviation on just one side
plotDf[plotDf$group == 1, ]$ebUpper = 0 # Upper error bar, if ebLower is also provided
plotDf[plotDf$group == 3, ]$ebLower = 0

lineChartDf(plotDf)

hardmanko/LineChart-package documentation built on Oct. 8, 2017, 2:57 p.m.