Add groups of points to a plot
Add groups of points to a plot
add_n_points(x, y, n, horiz = TRUE, width = NULL, sep = NULL, plot = TRUE, ...)
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 |
Jacolien van Rij
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()
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)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.