-
-
Notifications
You must be signed in to change notification settings - Fork 3
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
Bins function does not work properly #82
Comments
@Agucha1986, can you provide a reproducible example and the expected output? |
@tomroh, ideally, I would like to get a scale with the minimum and maximum values. So, the below one works and uses the min and max values to display on the legend, and the bins is ignored from what I understand. Is there a way to have a better control over breaks, like in ggplot2? pal <- colorNumeric("YlGnBu", na.color = "transparent", reverse = T, values(p)) |
The bins arg follows leaflet in that the I added support for manual breaks if you specify a vector > 1 and you can use expressions to set the bins argument. library(leaflet)
data("quakes")
numPal <- colorNumeric('viridis', quakes$mag)
leaflet(quakes) %>%
addTiles() %>%
addLegendNumeric(
pal = numPal,
values = ~mag,
bins = ~range(mag),
position = 'topright',
orientation = 'vertical',
title = htmltools::div('Min/Max w/ Formula', style ='margin-bottom:10px'),
numberFormat = function(x) sprintf('%.2f', x),
shape = 'rect',
decreasing = FALSE,
height = 100,
width = 20
) You can install from the dev branch and use it right now. |
Thank you very much for clarification.
Best regards,
Aga
…On Fri, May 3, 2024 at 3:44 AM Thomas Roh ***@***.***> wrote:
The bins arg follows leaflet in that the pretty function determines the
breaks. The documentation states that the bins argument is an approximate
number of breaks.
I added support for manual breaks if you specify a vector > 1 and you can
use expressions to set the bins argument.
library(leaflet)
data("quakes")numPal <- colorNumeric('viridis', quakes$mag)
leaflet(quakes) %>%
addTiles() %>%
addLegendNumeric(
pal = numPal,
values = ~mag,
bins = ~range(mag),
position = 'topright',
orientation = 'vertical',
title = htmltools::div('Min/Max w/ Formula', style ='margin-bottom:10px'),
numberFormat = function(x) sprintf('%.2f', x),
shape = 'rect',
decreasing = FALSE,
height = 100,
width = 20
)
You can install from the dev branch and use it right now.
—
Reply to this email directly, view it on GitHub
<#82 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BH4CXTYXV7DNHUQ43RX2BZDZAJ3PZAVCNFSM6AAAAABG7UGZXCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOJRGE2TGOBSGE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Hi Thomas,
Can I please ask one more question?
I have temperature measurements for one day, measured every 10
minutes, which creates a dataset with 144 rows.
I need to produce 144 maps, each showing 10-minute data. Later, all these
maps will be joined to create an animation to visualise how it changed
throughout the day.
For this to work, the legend will always need to have the same scale on all
maps, ideally the absolute minimum and maximum for that day.
I am planning to use loop, and I was wondering whether you think it is
possible to make the same legend for all maps regardless of the min/max
values for a particular 10-minute measurement.
Thank you in advance.
Regards,
Aga
…On Sat, May 4, 2024 at 6:36 AM Thomas Roh ***@***.***> wrote:
Closed #82 <#82> as completed.
—
Reply to this email directly, view it on GitHub
<#82 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/BH4CXT3KMKNYIMVNRZSVKUDZAPYOJAVCNFSM6AAAAABG7UGZXCVHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMJSG4YDAOJRGUYTENY>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Further to my email 30 minutes ago, I can't download from
***@***.***')
I also tried with remotes and the HTTP link to see if it works,
cannot open URL 'https://api.github.com/repos/tomroh/leaflegend/tarball/devel'
No success.
Aga
On Wed, May 8, 2024 at 6:03 PM Agnieszka Wujeska-Klause <
***@***.***> wrote:
… Hi Thomas,
Can I please ask one more question?
I have temperature measurements for one day, measured every 10
minutes, which creates a dataset with 144 rows.
I need to produce 144 maps, each showing 10-minute data. Later, all these
maps will be joined to create an animation to visualise how it changed
throughout the day.
For this to work, the legend will always need to have the same scale on
all maps, ideally the absolute minimum and maximum for that day.
I am planning to use loop, and I was wondering whether you think it is
possible to make the same legend for all maps regardless of the min/max
values for a particular 10-minute measurement.
Thank you in advance.
Regards,
Aga
On Sat, May 4, 2024 at 6:36 AM Thomas Roh ***@***.***>
wrote:
> Closed #82 <#82> as completed.
>
> —
> Reply to this email directly, view it on GitHub
> <#82 (comment)>, or
> unsubscribe
> <https://github.com/notifications/unsubscribe-auth/BH4CXT3KMKNYIMVNRZSVKUDZAPYOJAVCNFSM6AAAAABG7UGZXCVHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMJSG4YDAOJRGUYTENY>
> .
> You are receiving this because you were mentioned.Message ID:
> ***@***.***>
>
|
Use main now, it has been merged:
|
Github issues are for bugs/enhancements of the leaflegend package. If you are seeking help with how to code something, you can use StackOverflow or contact me directly. |
Bins argument does not set the required number of ticks. It would be great to have exact number than approximate.
The text was updated successfully, but these errors were encountered: