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. Thanks Nick Wray [[alternative HTML version deleted]]
? Tue, 9 Jan 2024 16:42:32 +0000 Nick Wray <nickmwray at gmail.com> ?????:> she has a problem with R studio on her laptopDoes the problem happen with plain R, without Rstudio? What's the student's sessionInfo()?> I have a screenshot which could email if anyone needs to see what it > looks like.I think that PNG screenshots are allowed on the mailing list, so it could be very helpful if you attached an appropriately cropped screenshot. -- Best regards, Ivan
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
It would help to have reproducible code. Use dummy data for confidentiality (if you care about that). My guess is that you set margins somewhere and never returned them to a default value. The first thing I would try is to open a new window in RStudio, copy the smallest piece of code that will give you the graph you want. Clear out the Environment using the broom icon, and then run your code. This makes sure that your results are only from your current code and not getting mixed up with stuff you ran last week/month. This might solve the problem, or it can be what you post as an example to get further help. There is an RStudio help forum that might also help. Tim -----Original Message----- From: R-help <r-help-bounces at r-project.org> On Behalf Of Nick Wray Sent: Tuesday, January 9, 2024 11:43 AM To: r-help at r-project.org Subject: [R] Truncated plots [External Email] 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. Thanks Nick Wray [[alternative HTML version deleted]] ______________________________________________ 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 http://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Nick, obviously figuring out the problem is best but you may want to deal with the symptom. RSTUDIO lets you adjust the sizes of the various windows and enlarging the window (lower right normally) where the graph is shown may be a first attempt if the problem is display space. And note RSTUDIO in that window lets you zoom a pop-out window with the graph. It also lets you save the graph into files with various formats. And, as someone else pointed out, you can change the program to choose a device to save the output in. Of course, if the real problem is in some aspect of the setup that causes the clipping, that has to be looked at. If the problem is in RSTUDIO, not just R, this is not the right forum to deal with it. Avi -----Original Message----- From: R-help <r-help-bounces at r-project.org> On Behalf Of Nick Wray Sent: Tuesday, January 9, 2024 11:43 AM To: r-help at r-project.org Subject: [R] Truncated plots 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. Thanks Nick Wray [[alternative HTML version deleted]] ______________________________________________ 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 http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.