Skip to content

ggplot2 package: argument of expand with scale_x_discrete()

2 messages · Fix Ace, Ista Zahn

#
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
#
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: