-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
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
annotation_scale and annotation_north_arrow appear in all facets #25
Comments
As I've written it, there isn't any way to change or omit the properties of a scalebar or north arrow on panels using facets. This is something I should fix! In |
Alright! This will be in the next version using syntax something like this: library(tidyverse)
library(ggspatial)
df <- tibble::tibble(
facet_var = c("one", "two", "three", "four"),
data = list(data.frame(x = 0:4, y = -(0:4)))
) %>%
tidyr::unnest()
scale_params <- tibble::tibble(
facet_var = c("one", "two", "three"),
width_hint = 0.25,
style = c("bar", "ticks", "bar"),
location = c("bl", "tr", "tl"),
unit_category = c("metric", "imperial", "metric"),
text_col = c("black", "red", "blue"),
line_col = c("black", "red", "blue")
)
ggplot(df) +
geom_point(aes(x, y)) +
annotation_scale(
aes(width_hint = width_hint, style = style, location = location, unit_category = unit_category,
text_col = text_col, line_col = line_col),
data = scale_params,
plot_unit = "m"
) +
facet_wrap(~facet_var) +
coord_fixed() Created on 2018-12-14 by the reprex |
Awesome, thanks! |
Hi There - I have been trying to get the code in your 12/14/2018 comment to work with my data and I have cannot for the life of me get it to work. I also do not see anything about facets in the help for version 1.1.7. Before I try to make a reprex with my data, I wanted to see if what was posted in 2018 is what was implemented to get a scale bar in only one facet. |
What about |
I often do faceted plotting with ggplot.
However, if using facets with annotations, such as
annotation_scale
andannotation_north_arrow
, appear on all facets. How would it be possible to make them appear only once, other than usingpatchwork
or similar, instead of facets?The text was updated successfully, but these errors were encountered: