R:一组图表
到目前为止,我已经设法创建了一个这样的图:
ggplot (df, aes (x, y)) + geom_point (col = 'yellow') + xlab ("A") + ylab ("B") + ggtitle ("Dose0.1") + geom_abline (slope = 1, linetype = 2, color = "red")
在轴上校准的措施
最好是在轴上进行功能
示例数据的形式:
structure(list(Np. = 1:32, A = c(62L, 62L, 54L, 54L, 10L, 10L,
14L, 14L, 50L, 50L, 43L, 43L, 22L, 22L, 48L, 48L, 34L, 34L, 57L,
57L, 60L, 60L, 1L, 1L, 63L, 63L, 2L, 2L, 44L, 44L, 34L, 57L),
B = c(1L, 7L, 2L, 29L, 1L, 15L, 27L, 28L, 14L, 15L, 48L,
49L, 1L, 2L, 1L, 21L, 18L, 19L, 23L, 24L, 14L, 15L, 29L,
31L, 1L, 2L, 1L, 36L, 2L, 19L, 19L, 23L), Dose = c(0.1, 1,
10, 1, 1, 0.1, 1, 1, 1, 1, 1, 1, 1, 0.1, 0.1, 0.1, 0.1, 0.1,
0.1, 0.1, 0.1, 0.1, 0.1, 10, 10, 10, 10, 10, 10, 10, 1, 1
)), class = "data.frame", row.names = c(NA, -32L))
I would like to create a collection of plots like this:
So far I have managed to create a single such plot:
ggplot (df, aes (x, y)) + geom_point (col = 'yellow') + xlab ("A") + ylab ("B") + ggtitle ("Dose0.1") + geom_abline (slope = 1, linetype = 2, color = "red")
With calibrated measures on the axes
Preferably in the form of a function
Example data:
structure(list(Np. = 1:32, A = c(62L, 62L, 54L, 54L, 10L, 10L,
14L, 14L, 50L, 50L, 43L, 43L, 22L, 22L, 48L, 48L, 34L, 34L, 57L,
57L, 60L, 60L, 1L, 1L, 63L, 63L, 2L, 2L, 44L, 44L, 34L, 57L),
B = c(1L, 7L, 2L, 29L, 1L, 15L, 27L, 28L, 14L, 15L, 48L,
49L, 1L, 2L, 1L, 21L, 18L, 19L, 23L, 24L, 14L, 15L, 29L,
31L, 1L, 2L, 1L, 36L, 2L, 19L, 19L, 23L), Dose = c(0.1, 1,
10, 1, 1, 0.1, 1, 1, 1, 1, 1, 1, 1, 0.1, 0.1, 0.1, 0.1, 0.1,
0.1, 0.1, 0.1, 0.1, 0.1, 10, 10, 10, 10, 10, 10, 10, 1, 1
)), class = "data.frame", row.names = c(NA, -32L))
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果要在自己的函数中写入它,可以从
rlang
中组合{{}}
,告诉R,它应该寻找您的x 和
y
在这样的数据中参数:由
If you want to write it in your own function, you can combine the
{{}}
fromrlang
to tell R that it should look for yourx
andy
arguments inside the data like this:Created on 2022-07-04 by the reprex package (v2.0.1)
您可能需要更改格式化,但本质上是:
You may want to change formatting a little but essentially: