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

transparency does not seem to work in plotRGB() #1642

Closed
rCarto opened this issue Nov 6, 2024 · 2 comments
Closed

transparency does not seem to work in plotRGB() #1642

rCarto opened this issue Nov 6, 2024 · 2 comments

Comments

@rCarto
Copy link

rCarto commented Nov 6, 2024

Hi,
I couldn't get transparency to work in plotRGB(). See:

library(terra)
#> terra 1.7.83
b <- rast(system.file("ex/logo.tif", package="terra"))   
plotRGB(b, alpha = .5)

# the documentation says to set a value between 0 and 255 
plotRGB(b, alpha = 120)
#> Error in grDevices::rgb(t(grDevices::col2rgb(cols)), alpha = alpha, maxColorValue = 255): alpha level 30600, not in 0:255
packageVersion("terra")
#> [1] '1.7.83'
terra::gdal(lib="all")
#>     gdal     proj     geos 
#>  "3.6.2"  "9.1.1" "3.11.1"

I've also tried the a argument without success.

@rhijmans
Copy link
Member

Thank you for reporting this. Both plotRGB(b, alpha = .5) and plot(b, alpha = .5) now work as expected.

@rCarto
Copy link
Author

rCarto commented Nov 14, 2024

And thank you for the fix!

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