如果这个问题是不言自明的,请原谅我,但我仍在努力掌握 R 的更多功能。
我目前正在尝试使用 R 用我在 excel 中绘制的线条重新绘制累积频率。
我认为我的很多问题都来自有很多没有数据的单元格,因为我不断收到警告:
<块引用>警告信息:
1:删除了包含缺失值的 81 行(geom_path)。
2:删除了包含缺失值的 81 行(geom_path)。
3: 删除了 81 行包含缺失值 (geom_path)。
这是因为每列代表一个记录频率,只发生了 21 天,每个记录周期之间有 20 天的休息时间。
我曾尝试使用
import Feather from 'react-native-vector-icons/Feather';
const App: () => React$Node = () => {
return (
<Feather name="chevron-left" color={'#2F80ED'} size={30} />
);
};
export default App;
和 geom_ steps()
,但最终得到了这些:
当我使用 geom_points()
函数时,轴被创建但没有绘制任何内容。
x 轴上的日期看起来也很糟糕,我尝试使用代码 geom_line()
来旋转标签,但它看起来仍然很糟糕,我不确定它是否只是多个日期。
这是我一直在尝试为各种 geom 函数工作的代码:
+ theme(axis.text.x = element_text(angle = 90))
我希望这一切都有意义,并提前感谢大家提供的任何帮助!
我使用 ggplot() +
geom_point(aes(x = Date, y = d2s1, group = 1), data = cf) +
geom_point(aes(x = Date, y = d20s1, group = 1), data = cf) +
geom_point(aes(x = Date, y = d10s1, group = 1), data = cf) +
theme(axis.text.x = element_text(angle = 90))
ggplot() +
geom_step(aes(x = Date, y = d2s1, group = 1), data = cf) +
geom_step(aes(x = Date, y = d20s1, group = 1), data = cf) +
geom_step(aes(x = Date, y = d10s1, group = 1), data = cf) +
theme(axis.text.x = element_text(angle = 90))
ggplot() +
geom_line(aes(x = Date, y = d2s1, group = 1), data = cf) +
geom_line(aes(x = Date, y = d20s1, group = 1), data = cf) +
geom_line(aes(x = Date, y = d10s1, group = 1), data = cf) +
theme(axis.text.x = element_text(angle = 90))
读入数据。
我在下面附上了 read.csv("cf.csv")
的输出。
dput(cf)
答案 0 :(得分:0)
函数 geom_step()
有一个参数 na.rm
来删除 NA
值,默认情况下是 FALSE
。将此更改为 TRUE
应该会给你你想要的图。或者,您可以将 NA
数据更改为零以获得相同的效果。
拥挤的 x 轴是将数据存储为因子而不是日期时会发生的典型情况。这将与您读取数据的方式有关,而您尚未显示这些数据。