I want to plot a legend outside of a plot area and it must be fixed in the same place starting under the x axis. I tried
par(mar=c(5.1, 4.1, 3.1, 2.1))
plot(rnorm(100,0,1),xlab="")
legend("bottom", xjust=0.5,"this is a scatter plot",xpd=NA,bty="n",inset =
c(0,-0.2))
However when I enlarged the plot area and played with it the legend is broken sometimes it was inside the plot when the width is too low and sometimes it was too far awy from it. Is it a problem of R studio that I am using or from anything else like margins of the plot or changing height and width of plot pane... I have not tried it with R just only in R studio
I also tried with par("usr")
however it was still degenerated when plot pane was enlarged.
How can I do this the legend will stay in the same place in plot pane? I edited the code. thanks a lot.