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(): arguments "breaks" and "breakby" do not work for spatial raster objects #1187

Closed
aloboa opened this issue Jun 15, 2023 · 3 comments
Closed

Comments

@aloboa
Copy link

aloboa commented Jun 15, 2023

It would be very useful being able to define the distribution of colors of spatial raster objects in plet()

library(terra)
r <- rast(system.file("ex/elev.tif", package="terra"))
plet(r, tiles="")
plet(r, tiles="", breaks=seq(0,300, by=50))
# Error in .local(x, ...) : 
#  unused argument (breaks = c(0, 50, 100, 150, 200, 250, 300))
plet(r, tiles="", breakby="eqint")
# Error in .local(x, ...) : unused argument (breakby = "eqint")

By now I circumvent with:

 rp <- as.polygons(round(r))
 plet(rp,"elevation" , breaks=c(seq(100,300,by=50),500), border=NA, fill=0.8, col=terrain.colors(8)[1:5])    
@rhijmans
Copy link
Member

The arguments do not work because they do not exist (see the manual for plet<SpatRaster>). It would be nice to have them, of course.

@rhijmans
Copy link
Member

Thanks, you can now do things like:

library(terra)
r <- rast(system.file("ex/elev.tif", package="terra"))
plet(r, tiles="", breaks=seq(100,600, by=100))
plet(r, tiles="", breaks=5)

@aloboa
Copy link
Author

aloboa commented Jan 28, 2025

Excellent! thanks

netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Feb 15, 2025
# version 1.8-21

## bug fixes

- `sieve` failed with large rasters
  [#1729](rspatial/terra#1729) by Reed
  Humphrey

- `extractRange` only worked for SpatVector, not for matrix or vector
  [#1733](rspatial/terra#1733) by Victor Van
  der Meersch

- `extract<SpatRaster>` over https with a multilayer SpatRaster
  returned the values for the first layer for all layer
  [#1736](rspatial/terra#1736) by Shannon
  Albeke

## enhancements

- new argument xyz="" to the `rast<SpatVector>` method

- new arguments "type" and "breaks" to `plet<SpatRaster>` method
  [#1187](rspatial/terra#1187) by Augustin
  Lobo

- new argument "cores" in `lapp<SpatRasterDataset>`
  [#1190](rspatial/terra#1190) by kel44

- `aggregate<SpatRaster>` now handles `fun="table"`
  [#1662](rspatial/terra#1662) by Fernando
  Aramburu.

## new

- `is.flipped<SpatRaster>` method
  [#1627](https://github.com/rspatial/terra/issues/1627)>` by Timothée
  Giraud

- `as.array<SpatRasterDataset>` method

- `distance<SpatRaster,missing>` now has argument "values". If TRUE,
  the values of the nearest non-target cell is returned instead of the
  distance [#1243](https://github.com/rspatial/terra/is sues/1243) by
  Simon Dedman

- `thresh<SpatRaster>`
  [#1233](rspatial/terra#1233) by Agustin
  Lobo
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