SymbolixAU / googleway

R Package for accessing and plotting Google Maps
http://symbolixau.github.io/googleway/
Other
234 stars 46 forks source link

error handling using legend with column of hex colours #184

Open SymbolixAU opened 6 years ago

SymbolixAU commented 6 years ago
library(googleway)
set_key(read.dcf("GOOGLE_MAP_KEY")

melbourne$hex <- colourvalues::colour_values(melbourne$AREASQKM)

google_map() %>%
  add_polygons(
    data = melbourne
    , fill_colour = "hex"
    , polyline = "polyline"
    , legend = T
  )

Error in lst[sapply(lst, is.null)] <- NULL : invalid subscript type 'list'

zeehasham commented 4 years ago

Hi. I am also receiving the same error while using legend=T. Any updates on it?

dcooley commented 4 years ago

When using a column of hex colours, it doesn't make sense to have a legend, because the colours aren't mapped to a variable, so there is nothing to put in the legend itself. So you shouldn't use legend = TRUE when using hex colours.

But I do need to handle this error, so thanks for the reminder.