簡體   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