【发布时间】:2014-12-06 08:07:58
【问题描述】:
我的数据看起来像
头部(data1,10)
id time type value1 value2 value3
1 1612 7/1/2014 10:15 activity none
2 76308 7/1/2014 10:17 battery discharging
3 1613 7/1/2014 10:17 activity none
4 1614 7/1/2014 10:17 activity none
5 1615 7/1/2014 10:17 activity none
6 1616 7/1/2014 10:17 activity none
7 1617 7/1/2014 10:17 activity none
8 325200 7/1/2014 10:17 wifi linksys 00:1a:70:5b:8f:21 -86
9 1618 7/1/2014 10:19 activity none
10 1619 7/1/2014 10:19 activity none
可以下载this link格式的完整数据数据是csv,大小约为1.6 MB。 数据有 5 个重要列(时间、类型、值 1、值 2、值 3)。 type contains:activity表示用户活动(无、高、低)、短信、wifi等。
我想将我的数据绘制成如下所示:
X 轴是间隔一小时的时间,Y 轴是间隔一天的日期,然后每种类型都有不同的颜色,如图所示。
当多个值同时出现时,情节看起来更厚,而且对于我想要不同颜色的活动类型(无、高和低)。
【问题讨论】:
-
我可能给你的第一个建议是准备具有正确间隔的变量并使用
ggplot2(或lattice)。使用 ggplot2 你必须写类似ggplot(aes(x = time_1h, y = value, color = type, shape = type), data = yourdata) + geom_point() + facet_wrap(~ date_1day, ncol = 1) -
猜猜你只需要列
time和type就可以了。对吗? -
@KFB 当多个值同时出现时,情节看起来更厚,而且对于活动类型,我想要不同的颜色(无、高和低)。
-
您好,您没有澄清问题。是否只使用列
time和type进行绘图? -
@KFB 我也使用列 value1 因为列 value1 中的活动值