[R] Truncated plots

Duncan Murdoch murdoch@dunc@n @end|ng |rom gm@||@com
Tue Jan 9 18:13:43 CET 2024


On 09/01/2024 11:42 a.m., Nick Wray wrote:
> Hello As a postgrad I have been helping an undergraduate student with R
> coding but she has a problem with R studio on her laptop which I can't fix
> - basically when she runs a plot it appears without a y axis label with the
> black line plot frame hard against the plot window and the bottom of the
> plot, where you would expect to see the horizontal axis and the x axis
> label etc is completely "chopped off" by the bottom edge of the R studio
> interface window.  I can't find anything on the net detailing this problem
> - can anyone help?  I have a screenshot which could email if anyone needs
> to see what it looks like.
> 

Does this happen only in RStudio?  She can run `pdf("somefile.pdf")` 
before plotting and `dev.off()` after to save the results to a PDF file 
instead.  If the problem only occurs in RStudio, then you should 
probably contact Posit or one of their community support groups about it.

If it happens in other devices too:  is she using base graphics, or 
ggplot2, or something else?  If she's using base graphics, take a look 
at `par("mar")`.  That gives the size of the margins measured in lines 
of text; they are in the order bottom, left, top, right, with default 
value `c(5.1, 4.1, 4.1, 2.1)`.  Perhaps she has set the 2nd entry to zero.

I'm sure there's something similar in ggplot2 and other graphics 
systems, but I don't know what it would be.

Duncan Murdoch



More information about the R-help mailing list