Duncan Murdoch
2024-Nov-28 13:52 UTC
[R] Remove all box around a plot except bottom line (base graphics)
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
Michael Dewey
2024-Nov-28 15:27 UTC
[R] Remove all box around a plot except bottom line (base graphics)
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 >-- Michael
Fer
2024-Nov-28 17:36 UTC
[R] Remove all box around a plot except bottom line (base graphics)
That's pretty similar to call axis function, i.e.
?plot(rnorm(100), yaxt="n", bty="n")
?usr <- par("usr")
?## lines(usr[c(1,2)], usr[c(3,3)], xpd = TRUE)
?axis(1, ...) # where 1 is bottom, 2 left, 3 top, and 4 right sides of
the plot box)
Best
Fer
On 11/28/24 14: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
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> https://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
[[alternative HTML version deleted]]
Apparently Analagous Threads
- Remove all box around a plot except bottom line (base graphics)
- Remove all box around a plot except bottom line (base graphics)
- Remove all box around a plot except bottom line (base graphics)
- plot - no main title and missing abscissa value
- Help page of colors() : add a new example ?