1

我正在使用choroplethr包创建热图,但我无法设置阿拉斯加和夏威夷的不透明度。 在此处输入图像描述

代码:

  library(ggplot2)
  library(choroplethr)
  library(choroplethrMaps)

  data = data.frame(region=c(1001, 1003), value=c(-100,100))
  choro = CountyChoropleth$new(data)
  choro$ggplot_scale = scale_fill_gradient2("",
                                            low="red",
                                            high="green",
                                            na.value="white")
  choro$set_num_colors(1)
  plot = choro$render() + 
    theme(
          legend.background = element_rect(fill = "transparent",colour = NA),
          panel.background = element_rect(fill = "transparent",colour = NA),
          plot.background = element_rect(fill = "transparent",colour = NA),
          strip.background = element_rect(fill = "transparent",colour = NA),
          legend.key = element_rect(fill = "transparent",colour = NA)
    )
  ggsave(plot=plot,
         filename=paste0("~/counties.png"),
         bg="transparent")
4

0 回答 0