Skip to content

Discrete scale when using tidyterra::geom_spatraster #43

Answered by dieghernan
schonhose asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @schonhose:

On ggplot2 system, you can create a discrete scale on continuos mapped values with the scale_*_binned() functions https://ggplot2.tidyverse.org/reference/scale_colour_continuous.html. Some times this is abbreviated with a _b suffix, like in scale_fill_viridis_b() https://ggplot2.tidyverse.org/reference/scale_viridis.html.

These functions are passed to binned_scale https://ggplot2.tidyverse.org/reference/binned_scale.html that supports a breaks argument, so that may be what you are looking for.

Notice that the scales provided with tidyterra have three versions: *_c for continous values, *_b for binned values and *_d for discrete values.

So, in short, I think you can use *_b/…

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by dieghernan
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
📊 ggplot2 Issues related with the implementation of ggplot2 functionalities ❔ q&a Questions on the usage of tidyterra
2 participants
Converted from issue

This discussion was converted from issue #34 on September 21, 2022 07:04.