Remove extensions of axis

8 views
Skip to first unread message

vr

unread,
Sep 26, 2012, 4:01:12 AM9/26/12
to ggp...@googlegroups.com
By default, ggplot extends the plot slightly beyond the scale. How can one change this default behaviour? In plot (base graphics, that is), this is achieved by using xaxs="i" and yaxs="i".

Vikas

Kohske Takahashi

unread,
Sep 26, 2012, 4:04:06 AM9/26/12
to vr, ggp...@googlegroups.com
try this:

ggplot(data.frame(x = 1:3, y = 1:3), aes(x, y)) + geom_point() +
scale_x_continuous(expand = c(0, 0))

kohske

2012/9/26 vr <vikas...@agrarianresearch.org>:
> --
> You received this message because you are subscribed to the ggplot2 mailing
> list.
> Please provide a reproducible example:
> https://github.com/hadley/devtools/wiki/Reproducibility
>
> To post: email ggp...@googlegroups.com
> To unsubscribe: email ggplot2+u...@googlegroups.com
> More options: http://groups.google.com/group/ggplot2



--
Kohske Takahashi <takahash...@gmail.com>

Assistant Professor,
Research Center for Advanced Science and Technology,
The University of Tokyo, Japan.
http://www.fennel.rcast.u-tokyo.ac.jp/profilee_ktakahashi.html
Reply all
Reply to author
Forward
0 new messages