Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

SOLVED: tick size and labels of time x-axis in format %m:%s in r basic

Jasmin:

currently I am looking at volume data for a year and it looks like, that there is an re-occuring intraday pattern for every 15min-, 30min-, 45min and 00min product, as there exist 4 products for each hour of a day.

I would like to plot the mean volume of 4 random hours of the day and on the x.axis split it to the quarterly part.

It should look like the following mean volume

as you can see, I have troubles with the x-axis, to display it in the format %M:%S. Maybe somebody can help.

I extracted from the whole data, 4 random products, and aggregated the volume in regards to delivery-time

to keep it simple, a small piece from the dataset (only one day and two hours):

date_time2

time2

date_time10

time10

volume_hour2_mean volume_hour10_mean

volume_hour2_mean[1,1] volume_hour2_mean[2,1] volume_hour2_mean[3,1] volume_hour2_mean[4,1]

volume_hour10_mean[1,1] volume_hour10_mean[2,1] volume_hour10_mean[3,1] volume_hour10_mean[4,1]

volume_hour2_mean[1,2] volume_hour2_mean[2,2] volume_hour2_mean[3,2] volume_hour2_mean[4,2]

volume_hour10_mean[1,2] volume_hour10_mean[2,2] volume_hour10_mean[3,2] volume_hour10_mean[4,2]

par(mar=c(5,4,4,5)+.1)
plot(strptime(volume_hour2_mean[,1], format="%H:%M:%S", tz="CET"), volume_hour2_mean[,2], axes =FALSE, type="l", main="mean volume with delivery time x for hour z", xlab="delivery time in hour", ylab="volume in MWh", col="red",lwd=0.5, ylim=c(0,10))
par(new=TRUE)
plot(strptime(volume_hour10_mean[,1], format="%H:%M:%S", tz="CET"), volume_hour10_mean[,2],axes =FALSE, type="l", main="mean volume with delivery time x for hour z", xlab="delivery time in hour", ylab="volume in MWh", col="blue",lwd=0.5, ylim=c(0,10))
legend("topleft",col=c("red","blue"),lty=1,legend=c("hour 2","hour 10"),bg="white", cex=0.75)
axis(1, at=volume_hour2_mean[,1], labels=c("00:15","00:30","00:45", "00:00"))
axis(2,at=c(seq(0, 12, 1)), labels=c(seq(0,12,1)))

>

I would like to have the %h:%m format and only those tick sizes - if I leave the axis statement row, and don't set the axes in the rows before to FALSE, tick sizes of 10min difference are given, and not nicely display in a correct format.



Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots
This Question have been answered
HERE


This post first appeared on Stack Solved, please read the originial post: here

Share the post

SOLVED: tick size and labels of time x-axis in format %m:%s in r basic

×

Subscribe to Stack Solved

Get updates delivered right to your inbox!

Thank you for your subscription

×