Closed
Description
The problem stems from an annotation about adding an out-of-panel position annotate. https://stackoverflow.com/questions/79222655/ggplot2-adds-a-second-image-title-on-the-right-side It has been suggested that ggplot 3.5.0 provides a more convenient location setup : ‘AsIs’ position aesthetics I()
. However, when mapping using coords_sf
, there are some problems: everything works fine without asserting default_crs
in it. Once this parameter is supplied, the labeled position changes. It should go back to using the x,y axis coordinates as defined.
library(tidyverse)
library(sf)
library(rnaturalearth)
ne_countries(continent = "africa") |>
# st_crs()
ggplot()+
geom_sf()+
ggtitle('left')+
annotate("text", label = "right", x = I(1), y = I(1), hjust = 1,
vjust = -1, size = 4) +
coord_sf(crs ="+proj=laea +y_0=0 +lon_0=155 +lat_0=-90 +ellps=WGS84 +no_defs",
# default_crs = st_crs(4326),
clip = "off")
library(tidyverse)
library(sf)
library(rnaturalearth)
ne_countries(continent = "africa") |>
# st_crs()
ggplot()+
geom_sf()+
ggtitle('left')+
annotate("text", label = "right", x = I(1), y = I(1), hjust = 1,
vjust = -1, size = 4) +
coord_sf(crs ="+proj=laea +y_0=0 +lon_0=155 +lat_0=-90 +ellps=WGS84 +no_defs",
default_crs = st_crs(4326),
clip = "off")
The position of the labeling has changed and seems to follow the definition of the axes:
Metadata
Metadata
Assignees
Labels
No labels