[R] Changing X axis of ggplot
Joshua Wiley
jwiley.psych at gmail.com
Tue Jan 3 07:13:01 CET 2012
Hi Aren,
Could you perhaps send us the output of:
dput(dallas[1:40, "offense_hour", drop = FALSE])
I believe your problem, but getting it to work in ggplot2 will be
easiest working with your actual data (or a bit of it anyway).
for ggplot2 specific questions, you might also checkout:
groups.google.com/group/ggplot2
a lot of very clever ggplot2ers there (including the author much more
than he is around Rhelp).
Cheers,
Josh
On Mon, Jan 2, 2012 at 7:34 PM, Aren Cambre <aren at arencambre.com> wrote:
> Thanks to Joshua Wiley for turning me on to ggplot2.
>
> I am making a plot using this:
> p <- ggplot(dallas, aes(x = offense_hour)) + geom_bar() + coord_polar()
>
> Dallas is a data frame, and offense_hour is a column with chron
> objects from the chron library. In this case, the chron object was
> created with the times function. It is only a time (H:M:S) with no
> date attached.
>
> The plot shows up fine, but the X axis labels are 0.0 through 1.0. How
> do I convert this to 0:00 through 23:59 (or whatever may be
> appropriate given the breaks)?
>
> My searches lead me to scale_x_discrete, but I am not clear if that's
> even the right function.
>
> Aren
>
> ______________________________________________
> R-help at r-project.org mailing list
> 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.
--
Joshua Wiley
Ph.D. Student, Health Psychology
Programmer Analyst II, Statistical Consulting Group
University of California, Los Angeles
https://joshuawiley.com/
More information about the R-help
mailing list