简体   繁体   English

R中绘图区域外的绘图点

[英]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: 我想在R中某个绘图的绘图区域外添加点(星号)。但是,以下代码仅允许在绘图区域内添加点:

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')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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