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
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
lineChartDf(
  plotDf,
  title = "",
  xlab = NULL,
  ylab = NULL,
  ylim = NULL,
  xlim = NULL,
  plotXAxis = TRUE,
  plotYAxis = TRUE,
  legendPosition = "CHOOSE_BEST",
  legendTitle = "GROUP_NAME",
  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?

legendPosition

The position at which the legend should be placed. If NULL, no legend is plotted. If "CHOOSE_BEST", the best legend position is selected. Otherise, it is passed through to legend() directly.

legendTitle

The title to be used in the legend box. If "GROUP_NAME" (default), the name of the source of data for the grouping variable will be used. If no legend title is desired, use NULL.

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.

...

Additional parameters, currently passed on to the legend creating functions.

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 Aug. 26, 2020, 10:39 a.m.