Skip to content
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

plet legend issues, wrong numbers and no legend values for spatRaster with non integer values #983

Closed
simonrolph opened this issue Jan 24, 2023 · 2 comments

Comments

@simonrolph
Copy link

simonrolph commented Jan 24, 2023

I am using leaflet version 2.1.1.9000 and terra version 1.7.2 (development version from r-spatial not CRAN) and R version 4.2.2

library(leaflet)
library(terra)
packageVersion("leaflet")
#[1] ‘2.1.1.9000’
packageVersion("terra")
#[1] ‘1.7.2’
# R.version              _                                
#platform       x86_64-w64-mingw32               
#version.string R version 4.2.2 (2022-10-31 ucrt)
 
#I create a spatRaster for reproducing the error. The values go from 1 to 9
test_rast <- rast(matrix(1:9,3,3),crs="epsg:4326")
test_rast
#class       : SpatRaster 
#dimensions  : 3, 3, 1  (nrow, ncol, nlyr)
#resolution  : 1, 1  (x, y)
#extent      : 0, 3, 0, 3  (xmin, xmax, ymin, ymax)
#coord. ref. : lon/lat WGS 84 (EPSG:4326) 
#source(s)   : memory
#name        : lyr.1 
#min value   :     1 
#max value   :     9 
 
#plots okay but numbers are wrong
test_rast %>% plet(tiles = "OpenTopoMap")

#there are no numbers in the legend
plet(test_rast/2,tiles = "OpenTopoMap")
 

Here's a screenshot of the first map with the wrong values which should go from 1-9:
image

And the second map with no values in the legend because I have divided all the values by 2 so there are decimal places
image

@rhijmans
Copy link
Member

Thanks very much for reporting. Fixed now.

@simonrolph
Copy link
Author

Thanks @rhijmans much appreciated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants