Skip to content

Could convert a square raster to a hexagon when plotting with geom_spatraster #141

@zzzqiii

Description

@zzzqiii

Hi, I am using geom_spatraster to reproduce a figure from a paper and basically finished it.
This is my result.
image

And this is my code:

ggplot() + 
  geom_spatvector(data = global_land, fill = "grey88", size = 0.1, color = NA) +
  geom_spatraster(data=ra, aes(fill=Intertidal_marine_forests),maxcell = 3 * 10^6) + scale_fill_hypso_c() +
  theme_void()+
  theme(legend.position = c(0.1, 0.07))+
  theme(axis.title.x = element_blank(), 
        axis.title.y = element_blank(), 
        panel.background = element_blank())

However, I found the raster is hexagon in the original figure and it looks much clearer.
image
image

I wonder if I could convert a square raster to a hexagon when plotting with geom_spatraster.
Any hint would be appreciated. And please let me know if more information is needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGood for newcomers❔ q&aQuestions on the usage of tidyterra🏼 spatrasterRelated with SpatRaster📊 ggplot2Issues related with the implementation of ggplot2 functionalities

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions