r - Disappearing gridlines with ggplot2::coord_map - Stack Overflow

i am trying to plot maps with ggplot2 and have the issue of disappearing grid lines when zooming in.I

i am trying to plot maps with ggplot2 and have the issue of disappearing grid lines when zooming in.

I want to use orthographic projection, looking down at the North Pole but not show the full upper half of the sphere.

Plotting the full polar view works, however limiting the window to the desired area makes gridlines disappear. I believe that the issue has to do with xlim in coord_map, but I can not zoom using e.g. coord_cartesian to not use coord_maps xlim.

In the example map_full shows the full polar view with all gridlines and map_zoom shows the desired window, but with the disappearing gridlines (in the top left corner).

Is there any way to adjust the plot window after coord_map with interfering with the existing coordinate system?

Thanks you!

require("ggplot2")
worldmap <- map_data("world")

map_zoom <- ggplot()+
  geom_polygon(data=worldmap,aes(long,lat,group=group),fill="darkgrey")+
  coord_map("orthographic",orientation = c(90, 0, 0),ylim=c(0,90),xlim=c(-50,120))+
  scale_x_continuous(breaks=c(-6:6) * 30)+
  scale_y_continuous(breaks=c(-6:6) * 15)
map_full <- ggplot()+
  geom_polygon(data=worldmap,aes(long,lat,group=group),fill="darkgrey")+
  coord_map("orthographic",orientation = c(90, 0, 0))+
  scale_x_continuous(breaks=c(-6:6) * 30)+
  scale_y_continuous(breaks=c(-6:6) * 15)

map_full
map_zoom

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1743736165a4498300.html

相关推荐

  • r - Disappearing gridlines with ggplot2::coord_map - Stack Overflow

    i am trying to plot maps with ggplot2 and have the issue of disappearing grid lines when zooming in.I

    6天前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信