【发布时间】:2021-06-15 15:08:46
【问题描述】:
我有一个包含 3 个变量的融化 data.frame。
rn variable value
1 1 mhits_L$fhits 0.002262443
2 2 mhits_L$fhits 0.000000000
3 3 mhits_L$fhits 0.000000000
4 4 mhits_L$fhits 0.002262443
5 5 mhits_L$fhits 0.002262443
6 6 mhits_L$fhits 0.000000000
7 7 mhits_L$fhits 0.000000000
8 8 mhits_L$fhits 0.002262443
9 9 mhits_L$fhits 0.000000000
10 10 mhits_L$fhits 0.000000000
rn variable value
1 1 mhits_H$fhits 0.000000000
2 2 mhits_H$fhits 0.000000000
3 3 mhits_H$fhits 0.000000000
4 4 mhits_H$fhits 0.000000000
5 5 mhits_H$fhits 0.004273504
6 6 mhits_H$fhits 0.000000000
7 7 mhits_H$fhits 0.000000000
8 8 mhits_H$fhits 0.000000000
9 9 mhits_H$fhits 0.000000000
10 10 mhits_H$fhits 0.004273504
rn variable value
1 1 mhits_VH$fhits 0.000000000
2 2 mhits_VH$fhits 0.000000000
3 3 mhits_VH$fhits 0.000000000
4 4 mhits_VH$fhits 0.004291845
5 5 mhits_VH$fhits 0.004291845
6 6 mhits_VH$fhits 0.004291845
7 7 mhits_VH$fhits 0.000000000
8 8 mhits_VH$fhits 0.004291845
9 9 mhits_VH$fhits 0.000000000
10 10 mhits_VH$fhits 0.000000000
我想使用 seq(rn) 绘制平滑图:
ggplot(aes(x = seq(rn), y = value, color = variable)) +
stat_smooth(aes(y = value), position = "identity", method = "loess", span = 0.1,se = FALSE)
显示图(如图所示),其中每个变量都是分开的,而不是一个图,所有三个都具有相同的 x 轴 0-550。基本上所有三个都必须叠加在 0-550 的相同 seq(rn) 上。我错过了什么? plot
【问题讨论】:
-
您希望通过
seq(rn)完成什么?您的问题中也没有显示图像。请编辑并重新发布,以便我们了解发生了什么。 -
抱歉,情节已添加。没有seq(),smooth就不行,因为点太多了?打开其他选项而不是 seq() - 但是使用 seq,每个变量单独看起来都是我想要的方式。
-
看起来您只是显示了一小部分数据,因此很难找出问题所在。你能分享
data %>% group_by(variable) %>% summarize_all(range)的输出吗?