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
This issue is continuing the conversation in #171. See #171 (comment) onwards.
Request
71f346b added support for an explicit order aesthetic for geom_lineribbon(), making it possible to group ribbons together in layers as demonstrated in the reprex below. It would be nice if it was also possible to control the order of lines so they could be grouped with their ribbons. For example, in the plot below it would be nice to have a way to order the ribbons and lines in the following layers:
Group "a" ribbons
Group "a" line
Group "b" ribbons
Group "b" line
This isn't an urgent feature, and it's easy to workaround (see next section); but if it is possible it would be a nice to have.
library(tidyverse)
library(ggdist)
set.seed(1234)
n=5000df= tibble(
.draw=1:n,
intercept= rnorm(n, 3, 1),
slope= rnorm(n, 1, 0.25),
x=list(-4:5),
y= map2(intercept, slope, ~.x+.y*-4:5)
) %>%
unnest(c(x, y))
df_2groups= rbind(
mutate(df, g="a"),
mutate(df, g="b", y= (y-2) *0.5)
)
# Here it would be nice if there was a way to place the line for group "a"# below the ribbons for group "b":df_2groups %>%
ggplot(aes(x=x, y=y, fill=g)) +
stat_lineribbon(aes(
fill_ramp= after_stat(level),
order= after_stat(interaction(level, group))
)) +
labs(title="stat_lineribbon(aes(order = after_stat(interaction(level, group))))") +
theme_ggdist()
This issue is continuing the conversation in #171. See #171 (comment) onwards.
Request
71f346b added support for an explicit order aesthetic for
geom_lineribbon()
, making it possible to group ribbons together in layers as demonstrated in the reprex below. It would be nice if it was also possible to control the order of lines so they could be grouped with their ribbons. For example, in the plot below it would be nice to have a way to order the ribbons and lines in the following layers:This isn't an urgent feature, and it's easy to workaround (see next section); but if it is possible it would be a nice to have.
Created on 2023-03-08 with reprex v2.0.2
Current workaround
A simple way to accomplish the desired result is to plot multiple geoms in the desired order using subsets of the data:
Created on 2023-03-08 with reprex v2.0.2
The text was updated successfully, but these errors were encountered: