Closed dcarbajo closed 2 years ago
Hi @dcarbajo and thanks for the detailed reproducible example.
I believe the problem lies with your definition of plot_palette
, which does not include values associated with TRUE
and FALSE
taken by the Highlight
variable. The following change should result in those two flows being a darker shade than the others:
plot_palette <- c(plot_palette, `TRUE` = "black", `FALSE` = "grey")
However, Highlight
only takes two values, so using it as an aesthetic only enables you to use two colors, here black and grey—not three, e.g. black, red, and blue. To accomplish that, you might redefine Highlight
upstream as an interaction between itself and Dept
. Let me know if that doesn't turn out to work either!
Thanks for your comment, it really helped. Just needed to add the Highlight levels into the plot_palette. This is one of the plots with my real data, working well.
Great! Thanks for confirming.
I am wondering if it is possible to highlight specific links between nodes in an alluvial plot.
I manage to accomplish such task with
circlize::chordDiagram()
for circos plots, as it can accept a color palette for the grid (nodes) and a different one for the links.However, even when I thought would be much easier with
ggalluvial
, I find myself stuck. The main problem, as seen in the MWE below, is that I don't see a possibility to add a color palette for the nodes and a different one for the links.I made this MWE with a very similar structure to my real data, using the
UCBAdmissions
data, to show what I mean.This produces the following plot:
So far so good, but now I want to highlight specific links and nodes, in particular
Female
going to DeptsA
andD
.For that, I already have the
Highlight
column in my data. Now I just modify the color palette to grey out the links I don't want to highlight.This gives me this plot, which is not what I want:
What I would actually want is the following I mocked up:
Is that possible? I tried
fill = Highlight
in thegeom_flow()
line, but it didn't work... Seems like I would need to provide a second fill palette for the flow links. Hope you can help me!Thanks!