-
Notifications
You must be signed in to change notification settings - Fork 507
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add Leaflet.heatmap #174
add Leaflet.heatmap #174
Conversation
Is the range of the gradient always 0-1? |
If the range of the gradient is always 0-1, then instead of a gradient you could take a color function, like other leaflet functions do. leaflet() %>%
addTiles( ) %>%
setView( 178, -20, 5 ) %>%
addHeatmap( quakes_mat, blur = 30, max = 0.05, radius = 30,
color = colorNumeric("RdYlBu", 0:1)
) Then inside gradient <- as.list(color(0:20 / 20))
names(gradient) <- as.character(0:20 / 20) |
|
||
# using data(quakes) | ||
data(quakes) | ||
quakes_mat <- matrix(t(quakes[,c(1:2,4)]),ncol=3,byrow=T) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you change T
to TRUE
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
embarrassed that I let that through; changed
Kenton, can I trouble you to not use the leading-comma style in this repo? foo(
bar
,baz
,qux
) I generally try to be extremely laissez-faire about code formatting style, but this is going too far afield IMHO. :) |
Other than those comments, this looks great! Thanks! |
Oh sorry, I missed something quite obvious. If latlngs are just latitude/longitude pairs, then we don't pass them like this in leaflet. See the usage of derivePoints in e.g. addMarkers, which takes separate lng/lat parameters (and unfortunately it is lng then lat). |
Just to be crystal clear: addHeatmap should have lng=NULL, lat=NULL, and data=getMapData(map) parameters. Then call pts = derivePoints(data, lng, lat, missing(lng), missing(lat),
"addHeatmap") and pass |
@jcheng5, hope it is closer now. I tried to follow what I found on the |
Not sure that is how the |
@timelyportfolio Do you have time to vchat some time today or Monday? I'm very unclear on the semantics of intensity vs. max, even after studying the source code of Leaflet.Heat and simpleheat. Frankly I'm not sure the Leaflet.Heat behavior is correct/desirable. Can I sketch out what I'm seeing, you can tell me your understanding, and we'll see if we can make sense of it? |
@jcheng5 happy to vchat, but I have to admit, I am at a loss also. It is odd and not documented. All I can determine is that reducing the |
Take for example the
yields a
gives us a I guess if we want to be smart :) we could calculate the |
With your pull request to Leaflet.heat,I just discovered this very interesting and useful side effect. We can easily create dot maps. As an example,
I guess |
@jcheng5, there seems to be no movement on your pull request Leaflet/Leaflet.heat#32. I'm very much in favor of using your pull for this plugin for the purposes of this Thanks so much for all your help with this and finding what I think is a very good solution. |
Merge branch 'master' of https://github.com/rstudio/leaflet into feature/heatmap Conflicts: NAMESPACE
@timelyportfolio @jcheng5 is this going ahead? It is a very useful plugin... |
+1 will be nice to have. |
This really is an awesome feature ! I noticed that it is not yet integrated into master. Are you planning to do so ? Thank you all. |
Hi, great feature, been looking for some time for an interactive map with heatmap support. Do you know when will it be merged into the master branch? |
I'm closing this. I'm moving all new plugins to leaflet.extras package. |
Heatmap Support via an alternative but more performant plugin https://github.com/ursudio/webgl-heatmap-leaflet Now in trunk of https://github.com/bhaskarvk/leaflet.extras/ |
In response to #137, add Leaflet.heat to
leaflet
. While I think the implementation is complete, I would like some input on how I can make thegradient
argument moreR
-like or consistent withleaflet
. As of now, it looks like thisSome examples are in the
./inst/examples/heatmap.r
directory and also included in the documentation. I'll paste here also.