You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for an awesome package! I use this stuff all the time.
It appears that ggspatial reorders facets (alphabetically), which have a specific order as determined by the factor levels. It should maintain the facet ordering, especially when factors are used.
library(ggspatial)
packageVersion("ggspatial")
#> [1] '1.1.5'
library(ggplot2)
#> Warning: package 'ggplot2' was built under R version 4.1.2
packageVersion("ggplot2")
#> [1] '3.3.6'data<-data.frame(x=0:4, y=-(0:4))
data<-dplyr::bind_rows(
data|>dplyr::mutate(facet="c"),
data|>dplyr::mutate(facet="b"),
data|>dplyr::mutate(facet="a")
) |>dplyr::mutate(
facet=factor(facet, levels= c('c', 'b', 'a'))
)
scale_params<-tibble::tibble(
facet= c("a"),
location= c("tl")
)
ggplot(data) +
geom_point(aes(x=x, y=y)) +
annotation_scale(
data=scale_params,
aes(location=location)
) +
facet_wrap(~facet)
#> Using plotunit = 'm'
I just noticed this as well. It seems like it only happens when using something like scale_params to specify the facet where you'd like the scale placed.
Thanks for an awesome package! I use this stuff all the time.
It appears that ggspatial reorders facets (alphabetically), which have a specific order as determined by the factor levels. It should maintain the facet ordering, especially when factors are used.
Created on 2022-11-30 by the reprex package (v2.0.0)
The text was updated successfully, but these errors were encountered: