Axis labels and limits with ggplot scale_x_datetime
<p>I would like to get nice graphs with date, weekdays, and time as x-axis labels.</p>

<pre><code>test &lt;- data.frame(date=seq(as.POSIXct("2012-02-09 00:00:00",tz="CET"),as.POSIXct("2012-02-11 00:00:00",tz="CET"),"hours" ),
value= runif(49) )

ggplot() + geom_line(data=test, aes(x=as.POSIXct(date), y=value)) +
theme(text=element_text(size=16),
legend.text=element_text(size=16), 
axis.text=element_text(size=16, colour="black"),
panel.background = element_rect(fill = 'white', colour = 'black'),
axis.title.y = element_text(size=16, vjust = 0.3), 
axis.title.x = element_text(size=16, vjust = 0),
legend.key=element_rect(fill="white")) +
scale_x_datetime( breaks = date_breaks("1 days"), labels = date_format("%a-%d\n%H:%M", tz="CET"),
,limits = c(as.POSIXct("2012-02-09 00:00:00 CET"),as.POSIXct("2012-02-11 00:00:00 CET")))
</code></pre>

<p>Including scale_x_datetime as included in the MWE it looks like this: <a href="https://i.stack.imgur.com/tPE36.png" rel="noreferrer"><img src="https://i.stack.imgur.com/tPE36.png" alt="enter image description here"></a></p>

<p>There are several problems/questions:</p>

<p>1) How can I remove the blank spaces on the left- and right-hand side? Defining limits() was not successful.</p>

<p>2) How can I set the time (hour) that is shown, or in other words, at which timestamp the labels are placed? </p>

<p>3) When I change the timestamp like this</p>

<pre><code>test &lt;- data.frame(date=seq(as.POSIXct("2012-02-09 00:59:00",tz="CET"),as.POSIXct("2012-02-11 00:59:00",tz="CET"),"hours" ),
value= runif(49) )
</code></pre>

<p>the resulting plot(s) still show the timestamp with 00 minutes. Is there a way to change this?</p>