[R] Remove all box around a plot except bottom line (base graphics)
Martin Maechler
m@ech|er @end|ng |rom @t@t@m@th@ethz@ch
Thu Nov 28 17:51:23 CET 2024
>>>>> Michael Dewey
>>>>> on Thu, 28 Nov 2024 15:27:59 +0000 writes:
> Thank you Duncan, I will try that next.
> Michael
> On 28/11/2024 13:52, Duncan Murdoch wrote:
>> On 2024-11-28 8:36 a.m., Michael Dewey wrote:
>>> To make the plot clearer I have removed the axes but I wish to remove
>>> all the boz except the bottom horizontal line. Using the bty parameter
>>> does not seem to enable me to just leave the horizontal line at the
>>> foot. I can get the "l" version to remove everything except the left
>>> hand side and the base. I could also remove the entire box but that
>>> looks odd. Am I reading the documentation incorrectly or is it really
>>> impossible?
>>>
>>
>> It's not something that `bty` can specify or `box()` can do, but you can
>> draw a line using lines() or segments(). For example:
>>
>> plot(rnorm(100), yaxt="n", bty="n")
>> usr <- par("usr")
>> lines(usr[c(1,2)], usr[c(3,3)], xpd = TRUE)
>>
>> You might not even need the lines() call if you don't care how far the
>> axis extends.
>>
>> Duncan Murdoch
also, if like in this example, you are talking about using plot.default()
{or something that *calls* plot.default() eventually, such as
plot.formula() ...}
you might want to play with frame.plot = FALSE :
plot(rnorm(50), frame.plot=FALSE, yaxt="n")
maybe what you want? {a bit more efficient internally than 'bty = "n"'}
Martin
More information about the R-help
mailing list