繁体   English   中英

如何 plot x 轴上的一个表中的列和 y 轴上另一个表中的同名列

[英]How to plot a column from one table on x-axis and a column with same name from another table on y-axis

如何 plot x 轴上的一个表中的列和 y 轴上另一个表中的同名列? 我可以用这行代码得到我想要的结果:

countryT_stateT <- plot(Country$T, State$T)

但我很好奇如何在 tidyverse 中做到这一点。 所以我尝试了这段代码,但出现错误“geom_point 需要以下缺失的美学:y”

countryT_stateT <- ggplot()+
  geom_point(data=country, aes(x=T))+
  geom_point(data=state, aes(y=T))+
  labs(title = "Temperatury Country vs. State", subtitle = "2010-2020", 
       x = "Country T", y = "State T")+ 
  theme_classic()+
  theme(
    plot.title = element_text(hjust = 0.5),
    plot.subtitle = element_text(hjust = 0.5)
  )
countryT_stateT

谢谢!

如何 plot x 轴上的一个表中的列和 y 轴上另一个表中的同名列? 我可以用这行代码得到我想要的结果:

countryT_stateT <- plot(Country$T, State$T)

但我很好奇如何在 tidyverse 中做到这一点。 所以我尝试了这段代码,但出现错误“geom_point 需要以下缺失的美学:y”

countryT_stateT <- ggplot()+
  geom_point(data=country, aes(x=T))+
  geom_point(data=state, aes(y=T))+
  labs(title = "Temperatury Country vs. State", subtitle = "2010-2020", 
       x = "Country T", y = "State T")+ 
  theme_classic()+
  theme(
    plot.title = element_text(hjust = 0.5),
    plot.subtitle = element_text(hjust = 0.5)
  )
countryT_stateT

谢谢!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM