[R] ggplot2::coord_fixed() margin problem
Martin Møller Skarbiniks Pedersen
tr@xp|@yer @end|ng |rom gm@||@com
Sun Dec 20 18:00:09 CET 2020
On Sun, 20 Dec 2020 at 17:43, Rui Barradas <ruipbarradas using sapo.pt> wrote:
Thank you for trying to answer my question.
> I am not sure I understand the problem.
> With coord_fixed() both axis have the same length and the plot is a
> square. When resizing the plot window the white areas can be on
> top/bottom if the window height is bigger than its width or to the
> left/right if it's the other way around.
Yes.
> Does this answer the question?
Nope.
I really need the added space as the same color as the plot.background
(yellow2) in the example below.
However the code below generates a small white space. I was expected it to
be the
same as the plot.background color.
library(ggplot2)
g <-
ggplot() +
theme(
plot.background = element_rect(fill = "yellow2"),
panel.background = element_rect(fill = "yellow2"),
)
g <- g + coord_fixed()
g
Regards
Martin
[[alternative HTML version deleted]]
More information about the R-help
mailing list