日期时间字符串为x值的等高线图 [英] contour plot with date-time strings as x values

查看:72
本文介绍了日期时间字符串为x值的等高线图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试绘制一个彩色轮廓图,以x轴表示时间,以y表示深度,以z值表示温度。时间为:

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)

示例:

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)

temp的每一列代表不同的时间,每一行代表不同的深度。

Every column of temp represents a different time and every row represents a different depth.

推荐答案

这对我有用:

time2 <- as.POSIXct(time)

结果:

> 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"

现在绘制它:

filled.contour(time2,depth,t(temp))

这篇关于日期时间字符串为x值的等高线图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆