-
Notifications
You must be signed in to change notification settings - Fork 235
legend position #669
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
Comments
Legend are grob objects. You can construct a single legend by See https://jokergoo.github.io/ComplexHeatmap-reference/book/legends.html Note if you do this way, the space for the legends is not calculated anymore, which means, you need to manually arrange the white space for legends. m = matrix(rnorm(100), 10)
Heatmap(m)
lgd = Legend(title = "foo", at = letters[1:4], legend_gp = gpar(fill = 1:4))
draw(lgd, x = unit(0.5, "npc"), y = unit(0.5, "npc")) |
Then you need to manually construct all legends. It will be something like: lgd = packLegend(
Legend(title = "TD2TI", at = c("FALSE", "TRUE"), legend_gp = gpar(fill = c("red", "greem"))),
... # same for other discrete legend,
Legend(title = "log10\nBL/mean", col_fun = your_col_fun, ...),
... # other legends
) and remember to turn off all the default legends: Heatmap(..., top_annotation = HeatmapAnnotation(..., show_legend = FALSE), show_heatmap_legend = FALSE)
draw(lgd, x, y, ...) |
is there a way to put the legend at any coordinate in the figure?
Thanks,
The text was updated successfully, but these errors were encountered: