[R] ggplot2 package: argument of expand with scale_x_discrete()

Ista Zahn istazahn at gmail.com
Thu Dec 29 17:43:50 CET 2016


Use coord_fixed()

--Ista

On Thu, Dec 29, 2016 at 9:59 AM, Fix Ace via R-help
<r-help at r-project.org> wrote:
>
>
>
>  Hello, there,
> What exactly does "expand" do for this function?
> I followed the examples from the manual to get a plot:
>
> d <- ggplot(subset(diamonds, carat > 1), aes(cut, clarity)) +geom_jitter()
>
> I would like to have all the dots in a square instead of rectangular range. When I applied d + scale_x_discrete(expand=c(1,1)) and d + scale_x_discrete(expand=c(1,0)), I got the same plot (different from the original one though).
> Could anyone help me to figure out how to use this argument?
> Thank you very much!
> Ace
>
>
>
>
>
>         [[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.



More information about the R-help mailing list