-
Notifications
You must be signed in to change notification settings - Fork 28
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
spplot does not handle raster of 1 cell. #65
Comments
Looks like you have to load package raster first.
…On 10 November 2019 11:05:24 CET, alaindanet ***@***.***> wrote:
Hi,>
thank you very much for the package!>
>
I would expect that `sp::spplot()` can plot a raster of size 1 if
`sp::plot()` can do it.>
It is not a big issue I guess, but it is annoying when
testing/debugging functions with dummy datasets.>
>
``` r>
library('sp')>
r <- raster::raster(nrows = 1, ncols = 1, xmn = 2, xmx = 4, ymn = 26,
ymx = 28)>
raster::values(r) <- rnorm(length(raster::values(r))) >
>
# Does not work:>
spplot(r)>
#> Error in ***@***.***, is.na), 1, function(x) !all(x)):
dim(X) doit avoir un longueur positive>
# Work: >
plot(r)>
```>
>
![](https://i.imgur.com/TNhuepn.png)>
>
<sup>Created on 2019-11-10 by the [reprex
package](https://reprex.tidyverse.org) (v0.3.0)</sup>>
>
-- >
You are receiving this because you are subscribed to this thread.>
Reply to this email directly or view it on GitHub:>
#65
--
Sent from a phone. Please excuse my brevity.
|
Thanks. Unfortunately, it did not solve the problem library('raster')
#> Le chargement a nécessité le package : sp
r <- raster::raster(nrows = 1, ncols = 1, xmn = 2, xmx = 4, ymn = 26, ymx = 28)
raster::values(r) <- rnorm(length(raster::values(r)))
# Does not work:
spplot(r)
#> Error in apply(sapply(from@data, is.na), 1, function(x) !all(x)): dim(X) doit avoir un longueur positive
# Work:
plot(r) Created on 2019-11-10 by the reprex package (v0.3.0) |
Yes, this is a bug. Since it is a corner case and sp is in maintenance mode, I am not going to correct it. Thanks for reporting; PR will be accepted after someone tests it against all reverse dependencies. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
thank you very much for the package!
I would expect that
sp::spplot()
can plot a raster of size 1 ifsp::plot()
can do it.It is not a big issue I guess, but it is annoying when testing/debugging functions with dummy datasets.
Created on 2019-11-10 by the reprex package (v0.3.0)
The text was updated successfully, but these errors were encountered: