package ‘plt’ is not available (for R version 3.6.1

How do you solve this error while plotting a raster data to

r<- raster(xmn=-110, xmx=-90, ymn=40, ymx=60, ncols=40, nrows=40)
r<- setValues(r,1:ncell(r))
r
crs(r)
plot(r)

Hi, and welcome to the forum!

I am not aware of a package called {plt}, and neither is CRAN. You might want to upgrade your R version though, as 3.6.1 is rather long in the tooth by now. The current version is 4.0.1, with 4.0.2 expected in about a week or so.

But the code you shared is legit, it works and produces a raster plot.

Are you sure you have the package {raster} installed and loaded?

> library(raster)
> 
> r<- raster(xmn=-110, xmx=-90, ymn=40, ymx=60, ncols=40, nrows=40)
> r<- setValues(r,1:ncell(r))
> r
class      : RasterLayer 
dimensions : 40, 40, 1600  (nrow, ncol, ncell)
resolution : 0.5, 0.5  (x, y)
extent     : -110, -90, 40, 60  (xmin, xmax, ymin, ymax)
crs        : +proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0 
source     : memory
names      : layer 
values     : 1, 1600  (min, max)

> crs(r)
CRS arguments:
 +proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0 
> plot(r)

2 Likes

okey thank you i was able to configure and see where there were errors i think my version could have caused such staff

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.