[R] ggplot2::coord_fixed() margin problem

Rui Barradas ru|pb@rr@d@@ @end|ng |rom @@po@pt
Sun Dec 20 17:43:09 CET 2020


Hello,

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?

Hope this helps,

Rui Barradas

Às 12:22 de 20/12/20, Martin Møller Skarbiniks Pedersen escreveu:
> Hi,
>    I posted this on the Google Group for ggplot2 but got no response.
> https://groups.google.com/g/ggplot2/c/441srnt6RZU
> 
> So I hope someone can help me here instead?!
> 
> -
> 
> If I don't use the coord_fixed() then all the background is yellow as
> expected.
> But I need to coord_fixed() and then it adds a little white around my plot.
> Is it possible to avoid the white and use coord_fixed() ?
> 
> Here is a "Minimal, Reproducible Example":
> 
> library(ggplot2)
> g <-
>    ggplot() +
>    theme(
>       plot.background = element_rect(fill = "yellow2"),
>       panel.background = element_rect(fill = "yellow2"),
>    )
> g <- g + coord_fixed()
> g
> 
> Regards
> Martin M. S. Pedersen
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help using 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.
>



More information about the R-help mailing list