Learn R Programming

metaplot (version 0.7.1)

densplot_data_frame: Density Function for Data Frame

Description

Plot density for object of class 'data.frame' using dens_panel by default.

Usage

densplot_data_frame(x, xvar, groups = NULL, facets = NULL,
  xlab = metOption("metaplot_xlab_dens", axislabel),
  ref = metOption("metaplot_ref_x_dens", metaplot_ref),
  ref.col = metOption("metaplot_ref_col_dens", "grey"),
  ref.lty = metOption("metaplot_ref_lty_dens", "solid"),
  ref.lwd = metOption("metaplot_ref_lwd_dens", 1),
  ref.alpha = metOption("metaplot_ref_alpha_dens", 1),
  log = metOption("metaplot_log_dens", FALSE),
  crit = metOption("metaplot_crit_dens", 1.3),
  aspect = metOption("metaplot_aspect_dens", 1),
  scales = metOption("metaplot_scales_dens", NULL),
  panel = metOption("metaplot_panel_dens", dens_panel),
  colors = metOption("metaplot_colors_dens", NULL),
  symbols = metOption("metaplot_symbols_dens", NULL),
  points = metOption("metaplot_points_dens", TRUE),
  lines = metOption("metaplot_lines_dens", TRUE),
  fill = metOption("metaplot_fill_dens", FALSE),
  space = metOption("metaplot_space_dens", "right"),
  key = metOption("metaplot_key_dens", metaplot_key),
  as.table = metOption("metaplot_astable_dens", TRUE),
  main = metOption("metaplot_main_dens", NULL),
  sub = metOption("metaplot_sub_dens", NULL),
  settings = metOption("metaplot_settings_dens", NULL),
  padding = metOption("metaplot_padding_dens", 1),
  gg = metOption("metaplot_gg_dens", FALSE), ...)

Arguments

x

data.frame

xvar

variable to plot

groups

optional grouping variable

facets

optional conditioning variables

xlab

x axis label; can be function(x = x, var = xvar, log = log, ...)

ref

reference line; can be function(x = x, var = xvar, ...) or NULL to suppress

ref.col

color for reference line(s)

ref.lty

type for reference line(s)

ref.lwd

size for reference line(s)

ref.alpha

transparency for reference line(s)

log

whether to log-transform x axis (auto-selected if NA)

crit

if log is NA, log-transform if mean/median ratio for non-missing x is greater than this value (and no negative values)

aspect

passed to bwplot or ggplot; use 'fill', NA, or NULL to calculate automatically

scales

passed to xyplot or facet_grid or facet_wrap (guessed if NULL)

panel

passed to densityplot

colors

replacements for default colors in group order

symbols

replacements for default symbols in group order

points

whether to plot points: logical or alpha, same length as groups

lines

whether to plot lines: logical or alpha, same length as groups

fill

whether to fill curves: logical or alpha, same length as groups (symbol fill color is same as point color)

space

location of key (right, left, top, bottom)

key

list: passed to xyplot as auto.key or to theme; can be a function groups name, groups levels, points, lines, space, gg, and … . See metaplot_key.

as.table

passed to xyplot

main

character, or a function of x, xvar, groups, facets, and log

sub

character, or a function of x, xvar, groups, facets, and log

settings

default parameter settings: a list from which matching elements are passed to lattice (as par.settings) or to ggplot theme() and facet_wrap() or facet_grid(). ncol and nrow are used as layout indices for lattice (for homology with facet_wrap).

padding

numeric (will be recycled to length 4) giving plot margins in default units: top, right, bottom, left (in multiples of 5.5 points for ggplot)

gg

logical: whether to generate ggplot instead of trellis

...

passed to densityplot

See Also

Other univariate plots: dens_panel, densplot.data.frame, densplot, metaplot.data.frame, panel.meta_densityplot

Other densplot: densplot.data.frame, densplot

Other metaplot: boxplot_data_frame, categorical_data_frame, corsplom_data_frame, metaplot_key, metaplot, scatter_data_frame, test_metaplot

Examples

Run this code
# NOT RUN {
densplot_data_frame(Theoph, 'conc', grid = TRUE)
densplot_data_frame(Theoph, 'conc', 'Subject')
densplot_data_frame(Theoph, 'conc', 'Subject',
space = 'top', columns = 4, legend.direction = 'horizontal')
densplot_data_frame(Theoph, 'conc', 'Subject',
space = 'top', columns = 4, legend.direction = 'horizontal', gg = TRUE)
densplot_data_frame(Theoph, 'conc', , 'Subject')
# }

Run the code above in your browser using DataLab