add_n_points: Add groups of points to a plot

Description Usage Arguments Author(s) See Also Examples

View source: R/plot.R

Description

Add groups of points to a plot

Usage

1
add_n_points(x, y, n, horiz = TRUE, width = NULL, sep = NULL, plot = TRUE, ...)

Arguments

x

average X position of points to plot,

y

average Y position of points to plot,

n

number of points to plot (integer).

horiz

Logical: whether or not to plot the sequence of point in horizontal direction (x-axis). Defaults to TRUE, the points are plotted in horizontal direction.

width

Numeric value: width that sequence of points can take.

sep

Numeric value: separation between sequences of points. Separation reduces the width. If the value is smaller, the sequences take more space.

plot

Logical: whether or not to add the points to the plot. Defaults to true. If set to false, the x- and y-coordinates of the points are returned in a list.

...

Optional graphical parameters (see par).

Author(s)

Jacolien van Rij

See Also

Other Functions for plotting: addInterval(), add_bars(), alphaPalette(), alpha(), check_normaldist(), color_contour(), dotplot_error(), drawDevArrows(), emptyPlot(), errorBars(), fill_area(), getCoords(), getFigCoords(), getProps(), gradientLegend(), legend_margin(), marginDensityPlot(), plot_error(), plot_image(), plotsurface(), sortBoxplot()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
s <- table(cars$speed)
d <- tapply(cars$dist, list(cars$speed), mean)

emptyPlot(range(as.numeric(names(s))), range(d), 
    xlab='dist', ylab='mean speed')
add_n_points(as.numeric(names(s)), d, s, pch='*')

# decrease space between groups of points:
emptyPlot(range(as.numeric(names(s))), range(d), 
    xlab='dist', ylab='mean speed')
add_n_points(as.numeric(names(s)), d, s, sep=0)

# decrease width of groups of points:
emptyPlot(range(as.numeric(names(s))), range(d), 
    xlab='dist', ylab='mean speed')
add_n_points(as.numeric(names(s)), d, s, width=0.8)

# horizontal vs vertical:
emptyPlot(range(d),range(as.numeric(names(s))),  
    ylab='dist', xlab='mean speed')
add_n_points(d, as.numeric(names(s)), s, horiz=FALSE) 

plotfunctions documentation built on April 28, 2020, 5:10 p.m.