r - 单个图中的多个列
问题描述
我有一个数据框datas
,我想绘制我的每个列,我的代码如下。
有没有办法不geom_line()
为我的所有列写所有内容,因为有时我的 Df 中只有 10 列
library(ggplot2)
g = ggplot(datas , aes(x = -seq(500,0,by = -1), y= value , color = variable ) ) +
geom_line(aes(y = V1, col = "1")) +
geom_line(aes(y = V2, col = "2")) +
geom_line(aes(y = V3, col = "3")) +
geom_line(aes(y = V4, col = "4")) +
geom_line(aes(y = V5, col = "5")) +
geom_line(aes(y = V6, col = "6")) +
geom_line(aes(y = V7, col = "7")) +
geom_line(aes(y = V8, col = "8")) +
geom_line(aes(y = V9, col = "9")) +
geom_line(aes(y = V10, col = "10")) +
geom_line(aes(y = V11, col = "11")) +
geom_line(aes(y = V12, col = "12")) +
geom_line(aes(y = V13, col = "13")) +
geom_line(aes(y = V14, col = "14")) +
geom_line(aes(y = V15, col = "15")) +
geom_line(aes(y = V16, col = "16")) +
geom_line(aes(y = V17, col = "17")) +
geom_line(aes(y = V18, col = "18"))
解决方案
推荐阅读
- linux - 我在使用 docker compose 安装多个应用程序时遇到问题
- javascript - 每次另一个函数的输出发生变化时如何运行一个函数?
- macos - 在 MAC 上运行 Powershell PS1(WMI?DB?)
- swift - Swift:测试使用委托调用的 URLSession
- json - 递归结构的 Json 模式不起作用
- python - 使用 flow_from_directory 时出现荒谬的损失和度量值
- javascript - 如何在 Vue.js 中 v-for 循环嵌套导航?
- c# - MD5 中的数据类型转换,无论是 SSIS 还是 C#
- selenium - 在使用 selenium(geckodriver)打开的浏览器上运行美丽的汤
- python-3.x - 如何在 python 中合并多个 xls 工作表?