覆盖 ggmap 和 ggplot

Overlaying ggmap and ggplot

我正在尝试在 ggmap 之上显示 ggplot。

library(patchwork)
ggmap(seoul) + ggplot(data = install_time_df) +
  geom_point(aes(x = long, y = lat, size = capa_sum),
             color = "black", alpha = 0.55)

我试过 patchwork 库,但它并排显示它们,而不是重叠在同一显示器上。

没有拼凑,我收到以下错误消息:

Error : Can't add gg_heat to a ggplot object. Run rlang::last_error() to see where the error occurred.

您可以使用如下内容

ggmap(seoul) + 
  geom_point(data = install_time_df, aes(x = long, y = lat, size = capa_sum),
             color = "black", alpha = 0.55)