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

afrilandcover object can not be plotted #9

Open
avallecam opened this issue Apr 7, 2022 · 0 comments
Open

afrilandcover object can not be plotted #9

avallecam opened this issue Apr 7, 2022 · 0 comments

Comments

@avallecam
Copy link

Dear afrilearndata team,

The afrilandcover object can not be plotted using the raster::plot() function.

pacman::p_load_gh("afrimapr/afrilearndata")
pacman::p_load(raster)

# the issue is here:
raster::plot(afrilandcover)
#> Error in .local(.Object, ...):

# as a comparison, this works:
raster::plot(afripop2020)
#![](https://i.imgur.com/YyFGzUV.png)

Created on 2022-04-07 by the reprex package (v2.0.1)

when I try to plot it using the ggplot2 and stars packages I obtain the following output:

pacman::p_load(ggplot2)
pacman::p_load_gh("afrimapr/afrilearndata")
pacman::p_load(stars)

ggplot() +
  geom_stars(data = st_as_stars(afrilandcover))
#> Loading required package: raster
#> Warning: package 'raster' was built under R version 4.1.3
#> Loading required package: sp
#> trying to read file: C:\Dropbox\_afrimapr\data\landcover-modis\MCD12C1.A2019001.Majority_Land_Cover_Type_1.tif
#> Error in .local(.Object, ...):

Created on 2022-04-07 by the reprex package (v2.0.1)

I hope this reprex be useful to identify a possible issue.

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

1 participant