2

我正在尝试在 R 中创建一个具有基本世界地图的图形,其中位置覆盖在顶部作为点。我还想使用我的数据框中的其他数据指定点的大小和颜色。这是我的代码:

#reading in data
world <-map_data("world")
data <-read.csv("map_data.csv", header=TRUE)

#creating base worldmap
worldbase <- ggplot()+
  geom_polygon(data=world, aes(x=long, y=lat, group=group), fill=NA, color="black") + 
  coord_fixed(1.3)

#overlaying points on top of base map
worldbase +
  geom_point(data=data, mapping=aes(x=Long_DD, y=Lat_DD, size=total_bases, color=factor(seq_type))) #These are all columns in my dataframe containing longitude, latitude, continuous information (total_bases) and categorical information (seq_type).

目前,我收到错误消息

“错误:提供给连续刻度的离散值”

我知道这与我的 x 和 y 规格有关,但是我还能如何从我的数据框中绘制 lat 和 long 值?

4

0 回答 0