0

In the code below, how do I raise the number of fill levels to, say, 4 or 5?

suppressMessages(library(ggmap))
data(crime)
houston.map <- get_map(location = geocode("Houston"),
                       zoom = 14)
print(ggmap(houston.map, extent = "device", legend = "topleft") +
        stat_density2d(data = crime,
                       aes(x = lon, y = lat, fill = ..level.., alpha = ..level..),
                       size = 2,
                       bins = 10,
                       geom = "polygon") +
        guides(alpha = F))

enter image description here Thanks.

Manojit
  • 611
  • 1
  • 8
  • 18
  • What does "raise the number of fill levels to, say, 4 or 5" mean exactly? Have you tried adjusting the `bins = ` parameter? Maybe that's what you're after. – MrFlick Feb 26 '18 at 17:35
  • @MrFlick Yes - I thought the question may not be clear (or even correct) the moment I hit the Ask button. What I wanted to do was to play with the number of items in the legend, and thought, perhaps wrongly, that it can be controlled by changing the fill levels or bin count. Adjusting bins is not doing it. – Manojit Feb 26 '18 at 17:45

0 Answers0