如何为幸存者每天沿着每个强度绘制线条?

时间:2023-01-22 20:54:58

I was wondering if somebody could help me with a data set, I would like to make a graph of survivors on the y-axis and day on the x-axis. The problem I am having is trying to break up the data by the four intensity groups. Optimally I would like a graph with a trend line for all four intensities so that I can see if there are significant differences between them. Any help or tips would be much appreciated!Here is what my data frame looks like:

我想知道是否有人可以帮助我处理数据集,我想在y轴和x轴上绘制幸存者的图表。我遇到的问题是试图通过四个强度组来分解数据。最理想的是,我想要一个带有所有四种强度的趋势线的图形,以便我可以看出它们之间是否存在显着差异。任何帮助或提示将不胜感激!这是我的数据框架的样子:

  Intensity Day Survivors
1        0.0   0        37
2        0.0   1        29
3        0.0   2         9
4        0.0   3         1
5        0.0   4         1
6        0.0   5         0
7        0.0   6         0
8        0.0   7         0
9        0.1   0        40
10       0.1   1        28
11       0.1   2         8
12       0.1   3         0
13       0.1   4         0
14       0.1   5         0
15       0.1   6         0
16       0.1   7         0
17       0.2   0        40
18       0.2   1        26
19       0.2   2        15
20       0.2   3         8
21       0.2   4         5
22       0.2   5         3
23       0.2   6         1
24       0.2   7         0
25       0.4   0        47
26       0.4   1        29
27       0.4   2         5
28       0.4   3         0
29       0.4   4         0
30       0.4   5         0
31       0.4   6         0
32       0.4   7         0

3 个解决方案

#1


3  

You could try

你可以试试

library(ggplot2)

ggplot(x, aes(x = Day, y = Survivors, colour = as.factor(Intensity))) + 
   geom_point(pch = 15) +
   geom_line() +
   theme_bw()

如何为幸存者每天沿着每个强度绘制线条?

#2


2  

Lattice also does this easily.

莱迪思也很容易做到这一点。

library(lattice)

xyplot(Survivors ~ Day,
       data=x,
       groups=Intensity,
       grid=TRUE,
       type=c('p','l'),
       auto.key=list(title='Intensity', space='right')
       )

如何为幸存者每天沿着每个强度绘制线条?

#3


0  

If you are using Excel, just take a scatter plot with smooth lines and markers, then add 4 data series corresponding to your intensities 如何为幸存者每天沿着每个强度绘制线条?

如果您使用的是Excel,只需使用光滑的线条和标记绘制散点图,然后添加与您的强度相对应的4个数据系列

Then add whatever legend/descriptions you want

然后添加所需的任何图例/描述

#1


3  

You could try

你可以试试

library(ggplot2)

ggplot(x, aes(x = Day, y = Survivors, colour = as.factor(Intensity))) + 
   geom_point(pch = 15) +
   geom_line() +
   theme_bw()

如何为幸存者每天沿着每个强度绘制线条?

#2


2  

Lattice also does this easily.

莱迪思也很容易做到这一点。

library(lattice)

xyplot(Survivors ~ Day,
       data=x,
       groups=Intensity,
       grid=TRUE,
       type=c('p','l'),
       auto.key=list(title='Intensity', space='right')
       )

如何为幸存者每天沿着每个强度绘制线条?

#3


0  

If you are using Excel, just take a scatter plot with smooth lines and markers, then add 4 data series corresponding to your intensities 如何为幸存者每天沿着每个强度绘制线条?

如果您使用的是Excel,只需使用光滑的线条和标记绘制散点图,然后添加与您的强度相对应的4个数据系列

Then add whatever legend/descriptions you want

然后添加所需的任何图例/描述