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

show.legend() #69

Closed
dongyiyi opened this issue Jan 22, 2024 · 2 comments
Closed

show.legend() #69

dongyiyi opened this issue Jan 22, 2024 · 2 comments

Comments

@dongyiyi
Copy link

Thank you for developing this package! I tried to use the geom_spatial_rgb() function to plot the RGB plot with a raster object, which did great work, except for the legend. I run the code with show.legend = Ture, or modify the source code in the function. I always get the plot without the legend.

ggplot() + geom_spatial_rgb(data = raster_object, aes(x = x, y = y, r = loc_scaled, g = for_scaled, b = rev_scaled))

Thanks!

@mikemahoney218
Copy link
Member

Thanks for the issue! This is mostly intended; the normal use for this function is to include a "basemap" under other data, and so you don't want a legend for the base map (as the RGB values don't represent anything other than the desired RGB of the output image). I'm unfortunately not likely to add the ability to add legends to this function in this package; I unfortunately am not able to spare the time for that feature right now.

I believe this is a relatively standard approach; it looks like tidyterra also doesn't produce legends for its RGB method:
https://dieghernan.github.io/tidyterra/reference/geom_spatraster_rgb.html

That said, check out geom_spatraster() from tidyterra for a more generic method for visualizing rasters that might be helpful:
https://dieghernan.github.io/tidyterra/reference/geom_spatraster.html

@mikemahoney218 mikemahoney218 closed this as not planned Won't fix, can't repro, duplicate, stale Jan 22, 2024
@dongyiyi
Copy link
Author

Thank you for clarifying!

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