Here we introduce point types and sizes in R. How to set point types, change the point sizes and set point colors.

See also scatter plots and dot plots.

Some Arguments for Point Types & Sizes in R
Argument Usage
pch Setting point types
cex or pt.cex Setting point sizes
col Set point colors

1 Point Types in R

In this section we show the main point types in R for use in plots like scatter plots and dot plots.

This is set with the argument "pch", for example, pch = 1 or pch = "$".

Plot Point Types in R

Plot Point Types in R

See examples below.

2 Point Sizes in R

In this section we show to set point sizes in R for use in plots like scatter plots and dot plots.

This is set with the argument "cex" or "pt.cex" depending on the plot type, for example, cex = 1 or cex = 3.

Plot Point Sizes in R

Plot Point Sizes in R

See examples below.

3 Examples: Setting Point Types and Sizes in R

Here, we show some examples setting the point types and sizes as shown above.

Example using a scatter plot:

xdata = rnorm(20)
ydata = xdata + rnorm(20)/2
plot(xdata, ydata,
     pch = 4,
     cex = 1.7,
     col = "green")
Point Types and Sizes in R - Scatter Plot

Point Types and Sizes in R - Scatter Plot

Example using a dot plot:

dotchart(t(USPersonalExpenditure),
         pch = "$",
         pt.cex = 0.8,
         col = "salmon")
Point Types and Sizes in R - Dot Plot

Point Types and Sizes in R - Dot Plot

Copyright © 2020 - 2024. All Rights Reserved by Stats Codes