the scale_x_date or scale_x_datetime functions don't implement the
expand parameter that is used in other scale... functions to modify the
empty space left and right to the plots content.
Is there any workaround to remove the empty space, wenn x is a Date
object (besides transforming it to a continuous variable and setting the
labels manually)?
thank you
example:
library(ggplot)
d = data.frame(x=seq.Date(as.Date("2000-01-01"),
as.Date("2005-01-01"),by="days"),y=1:1828)
# scale_x_continuous works
ggplot(d,aes(y,y)) + geom_line() + scale_x_continuous("",expand=c(0,0))
# doesn't work
ggplot(d,aes(x,y)) + geom_line() + scale_x_datetime("",expand=c(0,0))
# empty space on the left and right side
ggplot(d,aes(x,y)) + geom_line() +
scale_x_datetime("",limits=c(as.Date("2000-01-01"),as.Date("2005-01-01")))
regards,
stefan
scale_datetime doesn't use expand - it always rounds down on the left
and up on the right so that a major break occurs outside the range of
the data. Could you give me an example where this isn't what you
want?
Hadley
> --
> You received this message because you are subscribed to the ggplot2 mailing list.
> To post to this group, send email to ggp...@googlegroups.com
> To unsubscribe from this group, send email to
> ggplot2+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/ggplot2
I would like to plot a large timeserie and a smaller plot with only a
subset of the large timeserie, to show some effect which is invisible in
the low resolution plot. These two plots should be combined into one, I
am doing this with inkscape till now.
something like this:
http://z107.de/uni/ggplot_example_expand.pdf
In this case I would prefere the expand=c(0,0) in the smaller plot, to
use the available space for the data and to make it more clear that this
is only a subset.
Best regards,
stefan
Hadley
best regards,
stefan