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

sensible colours for mess plots #14

Open
plantarum opened this issue Oct 3, 2023 · 2 comments
Open

sensible colours for mess plots #14

plantarum opened this issue Oct 3, 2023 · 2 comments

Comments

@plantarum
Copy link

When plotting the results of the mess analysis, the default behaviour uses a colour ramp that is difficult to interpret. Using the example from the docs, its impossible to see where 0 is, so we can't tell which areas are outside the range of the reference values:

defcol

As I understand it, the expected values range from maximum similarity at 100, down to 'minimum' similarity at 0, with negative values indicating increasingly 'dissimilar' values. We could use the col argument to plot.SpatRaster to produce more intuitive colors:

colMat <- data.frame(from = c(50, 25, 5, 0, -5, -25, -50, -100,
                              -Inf),
                     to = c(100, 50, 25, 5, 0, -5, -25, -50,
                              -100),
                     col = c("green", "aquamarine", "lightblue", "blue", 
                             "beige", "yellow", "brown",
                             "orange", "red"))

plot(mss[[10]], col = colMat)

goodcols

Those are not particularly ideal colours or intervals, but that seems better than the default.

This could be included in the example in the docs so users could set their own colours. Or perhaps it would be worth creating a class for mess output, such that a new plot method could be provided that would generate a nice colour scheme? If either of these sound useful I could put together a pull request.

  • tyler
rhijmans added a commit that referenced this issue Oct 12, 2023
@rhijmans
Copy link
Member

Thank you for the suggestions. I have added something similar to the example.

I do not want to create a new class. Instead I now plan to add support in "terra" for setting a "color table" with intervals to a SpatRaster such that the mess function could add a default legend to the output SpatRaster.

@plantarum
Copy link
Author

Perfect, thanks! I didn't know about the breaks argument, that makes for a straightforward plot.

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