I want to scatterplot a numeric vector versus daytime (%H:%M) in ggplot2.
I understand that
as.POSIXct(dat$daytime, format = "%H:%M")
is the way to go in terms of formatting my timedata, but the output vector will still include a date (today's date). Consequently, the axis ticks will include the date (March 22nd).
ggplot(dat, aes(x=as.POSIXct(dat$daytime, format = "%H:%M"), y=y, color=sex)) +
geom_point(shape=15,
position=position_jitter(width=0.5,height=0.5))
Is there a way to get rid of the date alltogether, especially in the plot axis? (All info I have found on messageboards seem to refer to older versions of ggplot with now defunct date_format arguments)
scale_x_continuous(labels = NULL)
? – Halfhearteddate_format()
is now in thescales
package – Addiscale_x_continuous
does not work on POSIXct vectors, as it produces an error message:Error in as.POSIXct.numeric(value) : 'origin' muss angegeben werden
– Polyethylenedate_format()
even useful here? Looks likedate_format(format = "%Y-%m-%d", tz = "UTC")
also needs a date, so I will probably need another ggplot2 solution. There is this: link but it either doesn't address my case, or I don't understand it. – Polyethylene