Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/fortran/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R 在干净的美国地图上映射点(50个州)_R_Google Maps_Ggplot2 - Fatal编程技术网

R 在干净的美国地图上映射点(50个州)

R 在干净的美国地图上映射点(50个州),r,google-maps,ggplot2,R,Google Maps,Ggplot2,我希望在干净的美国地图上绘制点(即,美国地图仅在白色背景上绘制,没有地形或文字)。这是示例数据(我的实际数据有50000点) 从RgoogleMaps在谷歌地图上绘制点是一个选项,但是背景不是白色的,这使得点很难看到。请指教 试试这样的方法: library(ggplot2) library(ggrepel) library(mapproj) us <- map_data('world', c('usa', 'canada', "hawaii", "

我希望在干净的美国地图上绘制点(即,美国地图仅在白色背景上绘制,没有地形或文字)。这是示例数据(我的实际数据有50000点)


RgoogleMaps
在谷歌地图上绘制点是一个选项,但是背景不是白色的,这使得点很难看到。请指教

试试这样的方法:

library(ggplot2)
library(ggrepel)
library(mapproj)

us <- map_data('world',
                   c('usa', 'canada', "hawaii", "mexico"))
ggplot()+
  geom_polygon(data=us, aes(x=long, y=lat, group = group), colour="grey20", fill="grey80")+
  geom_point(data = DATA, aes(x=Long, y = Lat), color = "red")+
  geom_text_repel(data = DATA, aes(x=Long, y = Lat, label = State), color = "red")+
  coord_map(projection = "mercator", xlim=c(-170, -50))+
  theme_bw()
库(ggplot2)
图书馆(ggrepel)
图书馆(mapproj)

我们试试这样的方法:

library(ggplot2)
library(ggrepel)
library(mapproj)

us <- map_data('world',
                   c('usa', 'canada', "hawaii", "mexico"))
ggplot()+
  geom_polygon(data=us, aes(x=long, y=lat, group = group), colour="grey20", fill="grey80")+
  geom_point(data = DATA, aes(x=Long, y = Lat), color = "red")+
  geom_text_repel(data = DATA, aes(x=Long, y = Lat, label = State), color = "red")+
  coord_map(projection = "mercator", xlim=c(-170, -50))+
  theme_bw()
库(ggplot2)
图书馆(ggrepel)
图书馆(mapproj)
我们
library(ggplot2)
library(ggrepel)
library(mapproj)

us <- map_data('world',
                   c('usa', 'canada', "hawaii", "mexico"))
ggplot()+
  geom_polygon(data=us, aes(x=long, y=lat, group = group), colour="grey20", fill="grey80")+
  geom_point(data = DATA, aes(x=Long, y = Lat), color = "red")+
  geom_text_repel(data = DATA, aes(x=Long, y = Lat, label = State), color = "red")+
  coord_map(projection = "mercator", xlim=c(-170, -50))+
  theme_bw()