我使用 ggplotgeom_contour_filled来绘制这张地图。我想将图例范围从 -2 更改为 11,就像我在参数中写的那样breaks = c(-Inf,-2., -1.5, -1., -0.5, 0, 0.5, 1, 1.5, 2, 3, 4, 5, 7, 9, 11,Inf),但该图仅显示图表中出现的颜色。此外,ggplot 会自动设置变量的颜色,但是否可以编辑轮廓的颜色?
这是我的代码:
ggplot(map, aes(y=Latitude, x=Longitude, z=variable)) +
ggtitle(title)+
geom_contour_filled(breaks = c(-Inf,-2., -1.5, -1., -0.5, 0, 0.5, 1, 1.5, 2, 3, 4, 5, 7, 9, 11,Inf))+
geom_map(data=world, map=world,
aes(long, lat, map_id=id),
size=0.1, fill=NA, color = "grey") + #America and Greenland
geom_map(data=canada, map=canada,
aes(long, lat, map_id=id),
size=0.2, fill=NA, color = "black")+ #Canada
xlim(-146,-44)+
ylim(35,90)+
theme(plot.title = element_text(hjust = 0.5))

