How To Add Points To a Plot in R @DataDaft
How To Add Points To a Plot in R  @DataDaft
Uploaded November 2020 | Updated November 2026, 1 hour ago
This video shows how to add points at arbitrary x, y positions to plots in base R and ggplot2.

If you find this video useful, like, share and subscribe to support the channel!

► Subscribe: youtube.com/c/DataDaft?sub_confirmation=1


Code used in this R Code Clip:

# Add points to a base R plot

# Create plot
plot(mtcars$mpg, mtcars$hp)

# Add a point
points(x = 15, # point x coordinate
y = 100, # point y coordinate
pch = 15, # point shape
col = "red", # point color
cex = 3) # point size

# Add another point
points(x = 25, # point x coordinate
y = 250, # point y coordinate
pch = 17, # point shape
col = "blue", # point color
cex = 4) # point size


# Add points in ggplot
library(tidyverse)

ggplot(data = mtcars, aes(x = mpg, y = hp)) +
geom_point() + # Create scatterplot
geom_point(aes(x=15, y=100), # Add a point
col ="red",
shape = 15,
size = 8) +
annotate("point", x=25, y=250, # Add another point
col ="blue",
shape = 17,
size = 10)


* Note: YouTube does not allow greater than or less than symbols in the text description, so the code above will not be exactly the same as the code shown in the video! I will use Unicode large < and > symbols in place of the standard sized ones.
How To Add Points To a Plot in RHow To Make a Histogram in RCoronavirus New Cases by State (USA: March 2020)How to Make a Density Plot in RHow To Use map() In Pandas (Python)How to Use enumerate() in PythonNaruto Power Levels Over Time (1 Second = 1 Episode)Introduction to R: Decision Treesdplyr: PipesPython for Data Analysis: Probability Distributionsdlpyr: rename and arrangestringr: String Matching
DataDaft |

How To Add Points To a Plot in R

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER