niceLinePlot: Nice line plot, possibly with many groups

Description Usage Arguments Value Examples

View source: R/nicePlots.R

Description

Nice line plot, possibly with many groups

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
niceLinePlot(
  data,
  x,
  y,
  group = NULL,
  color = NULL,
  linetype = NULL,
  line_size = 0.7,
  xlims = NULL,
  ylims = NULL,
  title = "",
  xlab = x,
  ylab = y,
  linename = linetype,
  colorname = color,
  linetypelabels = NULL,
  colorlabels = NULL,
  legendpos = "right"
)

Arguments

data

A dataset

x

horizontal axis variable

y

vertical axis variable

group, color, linetype

Character. Variables to group on. With changing linetype or color

line_size

Numeric. General size of lines

xlims, ylims

Numeric vectors of 2 elements. Axis limits

title

Plot title

xlab, ylab

Axis labels

linename, colorname

Optional variable names for groups to be displayed on legend

linetypelabels, colorlabels

Optional labels for grouos to be displayed on legend

legendpos

Legend position. Options: “left”,“top”, “right” (default), “bottom”

Value

A ggplot2-plot

Examples

1
2
3
4
niceLinePlot(ggplot2::mpg, "displ", "hwy", color = "class", linetype = "class",  ylim = c(10,50), line_size = 1)

# Changes to the label variables can be done directly
niceLinePlot(datasets::mtcars, "disp", "hp", color = "vs", colorlabels = c("V-shaped", "straight"), colorname = "Engine")

SZuzek/nicePlots documentation built on Dec. 18, 2021, 12:01 p.m.