Skip to content

Datum and axis breaks #45

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

You must be logged in to vote

My take on this:

Modifying the labels to avoid conversion to lon/lat

This can ve avoided by using coord_sf(datum) option. Just use the original datum defined on the CRS of the SpatRaster file coord_sf(datum = terra::crs(volcano2)):

library(tidyterra)
library(terra)
library(ggplot2)

f_volcano <- system.file("extdata/volcano2.tif", package = "tidyterra")
volcano2 <- rast(f_volcano)

p <- ggplot() +
  geom_spatraster(data = volcano2) +
  geom_spatraster_contour(data = volcano2, breaks = seq(80, 200, 5)) +
  scale_fill_whitebox_c() +
  labs(fill = "elevation")

p

# Keep datum
p +
  coord_sf(datum = terra::crs(volcano2))

Modifying the number of axis ticks

This is interesting. It depends on …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by dieghernan
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
1 participant