[R] ggplot2::coord_fixed() margin problem

Jeff Newmiller jdnewm|| @end|ng |rom dcn@d@v|@@c@@u@
Sun Dec 20 18:31:44 CET 2020

Perhaps ?expansion can help?

On December 20, 2020 9:00:09 AM PST, "Martin Møller Skarbiniks Pedersen" <traxplayer using gmail.com> wrote:
>On Sun, 20 Dec 2020 at 17:43, Rui Barradas <ruipbarradas using sapo.pt>
>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.
>> Does this answer the question?
>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
>be the
>same as the plot.background color.
>g <-
>   ggplot() +
>   theme(
>      plot.background = element_rect(fill = "yellow2"),
>      panel.background = element_rect(fill = "yellow2"),
>   )
>g <- g + coord_fixed()
>	[[alternative HTML version deleted]]
>R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
>PLEASE do read the posting guide
>and provide commented, minimal, self-contained, reproducible code.

Sent from my phone. Please excuse my brevity.

More information about the R-help mailing list