【发布时间】:2021-10-22 07:00:12
【问题描述】:
我正在尝试创建一个允许用户传入列名的函数,我发现生成的图只是屏幕中间的一个点。需要进行哪些更改才能使其按预期工作?我的极简示例是:
library(ggplot2)
weather <- data.frame(Month = month.name[1:5], `Low Temperature` = 20:16,
`High Temperature` = seq(30, 22, -2), check.names = FALSE)
xVariable <- "Month"
yVariable <- "High Temperature"
yVariable <- enquo(yVariable)
ggplot(weather, aes(x = xVariable, y = !!yVariable)) + geom_point()
【问题讨论】: