简体   繁体   中英

Plot points outside plotting region in 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?

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)

One way:

plot(1:10, 1:10)
par(new = TRUE, mar = c(0,0,0,0))
plot(1:10, 1:10, xaxt = 'n',yaxt='n')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM