I’m quite new to R and try to get started with plotting data. But I didn’t manage to get the x axis in the right order. It should be a time axis displaying the hours, starting with 00:00 to 23:59 with ticks every hour. I tried the axis.POSIXct()
function, but it did not work.
I really appreciate help. Thank you a lot in advance!
The code for the plotting was:
plot(V40VH_20171115_ACI$FILENAME, V40VH_20171115_ACI$MEAN, axes = FALSE, ylab = "ACI", xlab = "Hour")
axis(2, labels = TRUE)
box()
The code used for the other function:
axis.POSIXct(1, at=seq(from=as.POSIXct(strptime("00:00:00", format = "%H:%M:%S")), to=as.POSIXct(strptime("23:59:59", format = "%H:%M:%S")), by = 3600))
there is no error shown by R, but the function also don't change anything.
The current plot looks like this
output of dput(droplevels(head(V40VH_20171115_ACI)))
:
structure(list(FILENAME = structure(1:6, .Label = c("audio-solo_red_V40-VH-2017-11-15_00-00-03_00000_000.wav",
"audio-solo_red_V40-VH-2017-11-15_00-00-03_00059_997.wav", "audio-solo_red_V40-VH-2017-11-15_00-00-03_00119_995.wav",
"audio-solo_red_V40-VH-2017-11-15_00-00-03_00179_992.wav", "audio-solo_red_V40-VH-2017-11-15_00-00-03_00239_990.wav",
"audio-solo_red_V40-VH-2017-11-15_00-00-03_00299_987.wav"), class = "factor"),
SAMPLINGRATE = c(44100L, 44100L, 44100L, 44100L, 44100L,
44100L), BIT = c(16L, 16L, 16L, 16L, 16L, 16L), DURATION = c(60,
60, 60, 60, 60, 60), CHANNELS = c(2L, 2L, 2L, 2L, 2L, 2L),
INDEX = structure(c(1L, 1L, 1L, 1L, 1L, 1L), .Label = "acoustic_complexity", class = "factor"),
FFT_W = c(512L, 512L, 512L, 512L, 512L, 512L), MIN_FREQ = c(200L,
200L, 200L, 200L, 200L, 200L), MAX_FREQ = c(6000L, 6000L,
6000L, 6000L, 6000L, 6000L), J = c(3L, 3L, 3L, 3L, 3L, 3L
), LEFT_CHANNEL = c(882.7496684, 865.6946215, 883.3736804,
875.5323086, 883.8283249, 860.3658252), RIGHT_CHANNEL = c(891.6367376,
889.7834472, 913.2662579, 910.2207809, 916.431259, 892.7898033
), MEAN = c(887.193203, 877.7390344, 898.3199692, 892.8765448,
900.1297919, 876.5778143)), .Names = c("FILENAME", "SAMPLINGRATE",
"BIT", "DURATION", "CHANNELS", "INDEX", "FFT_W", "MIN_FREQ",
"MAX_FREQ", "J", "LEFT_CHANNEL", "RIGHT_CHANNEL", "MEAN"), row.names = c(NA,
6L), class = "data.frame")