Add NA value to ggplot legend for continuous data map

后端 未结 3 586
走了就别回头了
走了就别回头了 2021-02-06 00:51

I\'m using ggplot to map data values to a (fortified) SpatialPolygonsDataFrame, but many of the polygons have NA values because there is no data available.

I used na.va

3条回答
  •  独厮守ぢ
    2021-02-06 01:12

    you can replace your NAs with 0 using

    data[is.na(data)] <- 0
    

    that way your nas will be replaced by zero and yout legend will show "0s"

    And to show us the image you can have a blog and can paste the link here

提交回复
热议问题