Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Plot points outside plotting region in R

Tags:

plot

r

I want to add points(asterisks) outside the plotting region of a plot in R. However, the following code only allows points to be added inside the plotting region:

x = c(1:10)
y = c(1:10)
plot(x,y)
points(11, 7, pch = 8)

How can I adjust code to allow the point to be plotted outside the plotting region?

like image 433
luciano Avatar asked Mar 29 '26 19:03

luciano


1 Answers

This SO post might help! It's about legends, but you can probably apply the same method for what you want.

This worked for me:

> par(xpd=TRUE)
> x = c(1:10)
> y = c(1:10)
> plot(x,y)
> points(11, 7, pch = 8)
like image 58
Gumeo Avatar answered Apr 01 '26 11:04

Gumeo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!