다음은 ?legend
의 코드 예제 중 하나를 사용하여 찾고 있다고 생각하는 기본 예입니다.
#Construct some data and start the plot
x <- 0:64/64
y <- sin(3*pi*x)
plot(x, y, type="l", col="blue")
points(x, y, pch=21, bg="white")
#Grab the plotting region dimensions
rng <- par("usr")
#Call your legend with plot = FALSE to get its dimensions
lg <- legend(rng[1],rng[2], "sin(c x)", pch=21,
pt.bg="white", lty=1, col = "blue",plot = FALSE)
#Once you have the dimensions in lg, use them to adjust
# the legend position
#Note the use of xpd = NA to allow plotting outside plotting region
legend(rng[1],rng[4] + lg$rect$h, "sin(c x)", pch=21,
pt.bg="white", lty=1, col = "blue",plot = TRUE, xpd = NA)
'? '와'usr' 매개 변수를 살펴보십시오. – joran
플롯에'ggplot'을 사용하고 있습니까? 예제 코드와 그래픽을 보여 주면 원하는 것을 이해하는 데 도움이 될 수 있습니다. – Andrie