YuLab-SMU / aplot

Decorate a plot with associated information
https://yulab-smu.top/aplot
97 stars 14 forks source link

[Feature request] Align legend with the start and end of the axis #17

Open sbcalaff opened 2 years ago

sbcalaff commented 2 years ago

I wonder if it would be possible to implement a feature that make it possible to align the legend with the start and end of the axis. For example, in the figure below the legend extends along the Y-axis, perfectly aligned with the start and end of the axis. This new feature can be extended to the sharing of a single legend by multiple plots.

image (Image taken from https://uk.mathworks.com/help/examples/graphics/win64/CreatingColorbarsFullEmbedExample_01.png)

zhuchcn commented 1 month ago

Haven't tried it myself, but I assume you can make the "legend" simply as a heatmap using geom_tile and then it can be aligned to the main figure using insert_left. Hope this helps!