Fill specific points
dylanmr opened this issue · 4 comments
Hi!
Thanks for this great package. Is it possible to use theme_combmatrix to fill different points with different colors? I currently can only figure out how to change all points to a single color.
I have tried giving multiple colors here but it doesnt seem to work:
ggplot(resglia, aes(x=Celltype)) + geom_bar(fill=c(rep("black",5),"red", rep("black",4))) + theme_pubr() + scale_x_upset(n_intersections = 10) + theme_combmatrix( combmatrix.panel.point.color.fill = c(rep("black",5),"red", rep("black",4)))
Thanks,
Dylan
Hi Dylan,
no sorry, right now there is now way to specifically change the color of points in the combination matrix individually. Right now, the best you can do is to either fork the package and modify the make_combination_matrix_plot()
function or use a tool like Illustrator to modify the plot manually afterwards.
The problem is that I didn't yet come up with a good user interface to specify such styling. Simply using a vector of colors feels "untidy" to me. But I realize that this might be a useful feature, so if you (or anyone else who reads this) has suggestions how to implement this, I would be happy to hear them.
Best, Constantin
@const-ae I just added highlights to ComplexUpset. The end result allows for things like this:
And the user-interface for the above plot is:
queries=list(
upset_query(
intersect=c('Drama', 'Comedy'),
color='red',
fill='red',
only_components=c('intersections_matrix', 'Intersection size')
),
upset_query(
set='Drama',
fill='blue'
),
upset_query(
intersect=c('Romance', 'Comedy'),
fill='yellow',
only_components=c('Length')
)
)
More description is at the very end of the examples notebook. I was aiming to make my interface similar to what UpSetR does, but improve some aspects as well. It is a bit hacky but works well for me. The relevant commits are here and here.
Feel free to take inspiration from my implementation - hope it will benefit your package too!
Hi Dylan,
no sorry, right now there is now way to specifically change the color of points in the combination matrix individually. Right now, the best you can do is to either fork the package and modify themake_combination_matrix_plot()
function or use a tool like Illustrator to modify the plot manually afterwards.The problem is that I didn't yet come up with a good user interface to specify such styling. Simply using a vector of colors feels "untidy" to me. But I realize that this might be a useful feature, so if you (or anyone else who reads this) has suggestions how to implement this, I would be happy to hear them.
Best, Constantin
Hi Constantin,
Is there any update on this? I was wondering if I could "hack" the make_combination_matrix_plot() function as you mentioned and include a custom color vector to change specific point colors. I assume I could introduce the vector at the lines.
scale_color_manual(values= c(`TRUE` = theme$combmatrix.panel.point.color.fill,
`FALSE` = theme$combmatrix.panel.point.color.empty)) +
Would changing the "TRUE" to a vector cycle through the vector values for each point?
Hi eggrandio,
sorry no update on this. I think the best way to achieve this is still to fork the package and modify the make_combination_matrix_plot()
function. It actually shouldn't be too difficult to do this for a specific use case, because you could modify the df2
data.frame and use a new column instead of observed
as the color value of geom_point()
:
Maybe something along the lines of
...
df2 $highlighted_points <- ifelse(.data$observed, "observed", 'missing")
df2 $highlighted_points[index_of_special_points] <- "special"
...
plt <- plt +
geom_point(aes(color= .data$highlighted_points), size=theme$combmatrix.panel.point.size)
...
Best,
Constantin