We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I'm not sure if what I'm experiencing is the same problem as this one, again with incomplete labeling of the four positions of latitude and longitude: library(ggplot2) library(sf) library(rnaturalearth) # Data: coast <- ne_coastline(scale = 50, returnclass = "sf") crs_pr <- "+proj=longlat +lon_0=180 +datum=WGS84 +no_defs" coast1 = coast |> st_break_antimeridian(lon_0 = 180) |> st_transform(crs_pr) ggplot(coast1)+ geom_sf()+ coord_sf(expand = FALSE, xlim = c(st_bbox(coast1)['xmin'], st_bbox(coast1)['xmax']), label_axes = list(top = 'E',bottom = "E", left="N",right="N") ) The labeled line for latitude is not crossed with the panel boundary. When a little unreasonable adjustment is made (slightly limiting the range of x), everything works fine: ggplot(coast1)+ geom_sf()+ coord_sf(expand = FALSE, xlim = c(st_bbox(coast1)['xmin']+5, st_bbox(coast1)['xmax']-5), label_axes = list(top = 'E',bottom = "E", left="N",right="N") ) It happens even with `expand = FALSE` set, which is weird.
I'm not sure if what I'm experiencing is the same problem as this one, again with incomplete labeling of the four positions of latitude and longitude:
library(ggplot2) library(sf) library(rnaturalearth) # Data: coast <- ne_coastline(scale = 50, returnclass = "sf") crs_pr <- "+proj=longlat +lon_0=180 +datum=WGS84 +no_defs" coast1 = coast |> st_break_antimeridian(lon_0 = 180) |> st_transform(crs_pr) ggplot(coast1)+ geom_sf()+ coord_sf(expand = FALSE, xlim = c(st_bbox(coast1)['xmin'], st_bbox(coast1)['xmax']), label_axes = list(top = 'E',bottom = "E", left="N",right="N") )
The labeled line for latitude is not crossed with the panel boundary.
When a little unreasonable adjustment is made (slightly limiting the range of x), everything works fine:
ggplot(coast1)+ geom_sf()+ coord_sf(expand = FALSE, xlim = c(st_bbox(coast1)['xmin']+5, st_bbox(coast1)['xmax']-5), label_axes = list(top = 'E',bottom = "E", left="N",right="N") )
Originally posted by @Breeze-Hu in #2985
This is a similar problem for raster plotting. Even without some projection transformations (compared to the previously mentioned geom_sf data).
library(ggplot2) library(terra) library(tidyterra) #Example data downloaded from NOAA https://psl.noaa.gov/mddb2/makePlot.html?variableID=1570 or https://psl.noaa.gov/tmp/mddb2/_H5mqysfuv/subset.nc data <- rast('Path') ggplot()+ geom_spatraster(data = data,aes(fill = sst))+ scale_fill_viridis_c()+ coord_sf(expand = FALSE, label_axes = list(top = 'E',bottom = "E", left="N", right="N"))
The text was updated successfully, but these errors were encountered:
Thanks for the report! I think this is the same problem as described in #2985, so I'm going to close this issue in favour of that one.
Sorry, something went wrong.
No branches or pull requests
Originally posted by @Breeze-Hu in #2985
This is a similar problem for raster plotting. Even without some projection transformations (compared to the previously mentioned geom_sf data).
The text was updated successfully, but these errors were encountered: