Learn R Programming

vein (version 1.3.0)

colplot: Function to plot columns of data.frames

Description

colplot plots columns of data.frame

Usage

colplot(
  df,
  cols = names(df),
  xlab = "",
  ylab = "",
  xlim = c(1, nrow(df)),
  ylim = range(unlist(df[[cols]]), na.rm = TRUE),
  main = NULL,
  theme = "black",
  col = cptcity::cpt(pal = cptcity::find_cpt("pastel")[4], n = length(names(df))),
  type = "b",
  lwd = 2,
  pch = 1:ncol(df),
  familyfont = "",
  ...
)

Value

a nice plot

Arguments

df

data.frame.

cols

Character, columns of data.frame.

xlab

a label for the x axis, defaults to a description of x.

ylab

a label for the x axis, defaults to a description of x.

xlim

x limits

ylim

y limits

main

Character, a main title for the plot, see also title.

theme

Character; "black", "dark", "clean", "ink"

col

Colors. Default are cptcity colour palette "kst_18_pastels"

type

"p" for points, "l" for lines, "b" for both points and lines, "c" for empty points joined by lines, "o" for overplotted points and lines, "s" and "S" for stair steps and "h" for histogram-like vertical lines. Finally, "n" does not produce any points or lines.

lwd

a vector of line widths, see par.

pch

plotting ‘character’, i.e., symbol to use.

familyfont

"Character" to specify font, default is"", options "serif", "sans", "mono" or more according device

...

plot arguments

See Also

par

Other helpers: dmonth(), to_latex()

Examples

Run this code
if (FALSE) {
a <- ef_cetesb("CO", c("PC_G", "PC_FE", "PC_FG", "PC_E"), agemax = 20)
colplot(df = a, ylab = "CO [g/km]", theme = "dark", type = "b")
colplot(df = a, ylab = "CO [g/km]", theme = "dark", pch = NULL, type = "b")
colplot(df = a, ylab = "CO [g/km]", theme = "clean", type = "b")
colplot(df = a, ylab = "CO [g/km]", theme = "clean", pch = NULL, type = "b")
#colplot(df = a, cols = "PC_FG", main = "EF", ylab = "CO [g/km]")
#colplot(df = a, ylab = "CO [g/km]", theme = "clean")
}

Run the code above in your browser using DataLab