I am trying to produce a color contour plot showing time along the x axis, depth along the y and temperature as the z values. Time is given as:
"2011-01-01 00:01"
i.e. "%Y-%m-%d %H:%M"
Is there a method for producing the color contour plot from these, and using
filled.contour(Time,Depth,temp)
example:
time <- c("2011-01-01 01:00", "2011-01-01 02:00", "2011-01-01 03:00",
"2011-01-01 04:00")
depth <- seq(1,10,by = 1)
seq1 <- seq(1:40)
temp <- matrix(seq1, 10)
Every column of temp represents a different time and every row represents a different depth.
This works for me:
time2 <- as.POSIXct(time)
Result:
> time2
## [1] "2011-01-01 01:00:00 EST" "2011-01-01 02:00:00 EST"
## [3] "2011-01-01 03:00:00 EST" "2011-01-01 04:00:00 EST"
Now plot it:
filled.contour(time2,depth,t(temp))

来源:https://stackoverflow.com/questions/10782600/contour-plot-with-date-time-strings-as-x-values