Closed daattali closed 7 years ago
Hmm, is this what you are talking about?
It looks like there is zero margin around the x and y axis (both in refactored version and non. Note, this is the refactored version). I'm not getting any letters cut off in either version, though. Should we add padding around the plot?
Looks like it might be an RStudio Viewer issue maybe? Running this code:
p <- ggplot2::ggplot(mtcars, ggplot2::aes(wt, mpg)) + ggplot2::geom_point()
ggMarginal(p + xlab("gpjy"))
I get this in rstudio
But if I export the image, then the bottom is not cut off. You don't get that in rstudio?
Incidentally I just updated to R 3.4.0 today and the RStudio version I run doesn't support the latest version of the R graphics engine that is used in 3.4.0. However, using graphics engine version 2 I still don't get cutoff:
I think it's probably the ggplot2 version that's doing it. What version are you using? I'm at 2.2.1.
It also looks like you're getting plenty of margin space for the y-axis, which mine doesn't show.
I'm also at ggplot2 2.2.1
If we can't find the exact cause for these discrepancies easily, I wouldn't bother with it too much at this time. It's good to have this documented and we can come back to it later
I think I see what's going on here... This is using RStudio v 1.0.143:
Looks like when the plot is confined to the "Plots" tab as it is on the right hand side, the x-axis title is getting cut off. When you "zoom" (or print to a device - e.g., pdf, png) as is shown on the left hand side, something happens with the sizing of the graph where we don't see the problem.
I think we should add padding, as most people will view plots interactively through the plots tab and will wonder why it's getting cut off.
Also, there's this: https://support.rstudio.com/hc/en-us/articles/200488548-Problem-with-Plots-or-Graphics-Device
Strangely enough the Plots tab in RStudio server doesn't seem to have the issue that the desktop version does - at least for the graphs I've looked at.
I'm fairly convinced this is indeed an RStudio bug. Adding very minimal padding could be a good idea
Did you add this minimal bottom padding to #40 ?
Going to address in separate PR
Sounds good
At some point in the past year, the bottom margin of the x axis label has disappeared. The label is stuck to the bottom of the image without any space, and any letters that go lower the the standard line (such as "g" "j" "p" "q" "y") are cut off.
I'm not sure if this is because of newer ggplot version, or because of the refactoring from https://github.com/daattali/ggExtra/pull/26