[英]Mapping using ggmap & Stamen maps in R: labelling points and scale
[英]Mapping points using ggmap
數據是
> head(latlon1.df)
lat lon
1 35.86417 -95.65556
2 29.72333 -98.69444
3 29.52917 -97.46417
4 40.82806 -72.86556
5 26.73500 -81.05111
6 NA NA
ggmap(usa) +
geom_point(data = latlon1.df, mapping = aes(x = latlon1.df$lon, y = latlon1.df$lat), color = "red",size=1)
不斷獲得
mapping: x = ~latlon1.df$lon, y = ~latlon1.df$lat
geom_point: na.rm = FALSE
stat_identity: na.rm = FALSE
and I do not get a map or points The map was loaded with ggmap and works correctly as a map but the points do not appear on the map position_identity
您的示例不是代表,因為您既沒有提供ggmap被稱為 [minor] 的庫, ggmap
沒有提供usa
數據集的(樣本)(或獲取它的參考)[major]。 另外,請使用dput()
或dput(head())
發布您的輸入數據,而不是head()
。
不是每個人都熟悉每個 R package。 請通過幫助我們幫助您來幫助自己。
也就是說,我懷疑您的問題是您在geom_point
中使用的語法。 我懷疑您不需要在對aes
的調用中重復數據框名稱。 這是一個表示在不同幾何圖形中使用不同數據源時的正確用法的代表。
library(tidyverse)
set.seed(123)
x <- tibble(x=rnorm(10), y=rnorm(10))
y <- tibble(x=c(0, 1), y=c(0, 1))
x %>%
ggplot() +
geom_point(aes(x=x, y=y)) +
geom_line(data=y, aes(x=x, y=y), colour="red")
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.