Closed teunbrand closed 4 years ago
Now works pretty OK.
library(ggplot2)
library(ggh4x)
ggplot(mpg, aes(displ, cty)) + geom_point() +
facet_grid(cols = vars(year, cyl)) +
theme(
strip.background = element_part_rect(side = "b", colour = "magenta",
fill = NA),
panel.border = element_part_rect(side = "rt", colour = "black",
linetype = 2, fill = NA)
)
Created on 2020-06-02 by the reprex package (v0.3.0)
Hi, thanks for maintaining this tool.
Can we use different panel border line type for different layer of facet? for example, in the facet_nested, if we set the outer facet layer as year
and the inner facet layer as cyl
. Can we set the outer facet panel border line to be solid line, and set the inner facet panel border line to be the dashed line?
Thanks, Wenbin
If you want a to have a line at some place, but not a full rectangle; it would make sense to me that it would be possible to implement something like
element_part_rect(side = "tlbr", fill = NA, colour = "black")
. Theside
argument (abbrevated: top, left, bottom, right) would control where the lines would go.Inspiration here: https://github.com/wilkelab/ggtext/blob/master/R/element-textbox.R
Notes:
c("element_part_rect", "element_rect", "element")
element_grob.element_part_rect()
S3 method.