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
Describe the bug
I would like to make publication-quality editable figures of LIANA plots in SVG format, but am coming up an obstacle where the output SVG files are massive in size (~2 MB) and thus cause memory issues and crashing when loaded into a program such as powerpoint/illustrator, and even inkscape struggles.
The reason seems to be that the color bar legend for the annotation colors (here "magnitude_rank") is made up of thousands of tiny rectangles which is blowing up the number of points in the SVG.
This may be a plotnine issue, but perhaps you could look into it and maybe suggest a workaround?
For instance, although not ideal, is it possible to optionally rasterize the colorbar and leave the rest as SVG, like how scanpy does with UMAPs of thousands of points?
I will also look in how to report/address this upstream if necessary...
Indeed, this is purely on the plotnine side, but I found a way to rasterize the colour guide:
p2 = p + p9.guides(color=p9.guide_colorbar(display='raster', nbin=50))
p2.save('test2.pdf', dpi=300)
However, for some reason in my case it would move the colour bar whenever I tried to load it into inkscape... So, if this happens to you, you would have to drag it back 😅 😅 😅 Not sure if this is a plotnine or an inkscape 'feature'.
I used plotnine == '0.13.3'. I also tried with other 0.13.x versions but it did not resolve the shifting, while older versions have a different API and did not actually rasterize it...
Genuinely future liana versions should transition to matplotlib completely.
Thanks for the code - yes I tried that and my experience was it saved the filesize blowing up issue, but it moved the colorbar to the bottom left corner also!
Describe the bug
I would like to make publication-quality editable figures of LIANA plots in SVG format, but am coming up an obstacle where the output SVG files are massive in size (~2 MB) and thus cause memory issues and crashing when loaded into a program such as powerpoint/illustrator, and even inkscape struggles.
The reason seems to be that the color bar legend for the annotation colors (here "magnitude_rank") is made up of thousands of tiny rectangles which is blowing up the number of points in the SVG.
This may be a plotnine issue, but perhaps you could look into it and maybe suggest a workaround?
For instance, although not ideal, is it possible to optionally rasterize the colorbar and leave the rest as SVG, like how scanpy does with UMAPs of thousands of points?
I will also look in how to report/address this upstream if necessary...
To Reproduce
my_plot = li.pl.dotplot(adata = adata,
colour='magnitude_rank',
inverse_colour=True,
size='specificity_rank',
inverse_size=True,
source_labels=['CD34+', 'CD56+ NK', 'CD14+ Monocyte'],
target_labels=['CD34+', 'CD56+ NK'],
filter_fun=lambda x: x['specificity_rank'] <= 0.01,
)
my_plot.save("myfigure.svg", transparent=True)
Screenshots
If applicable, add screenshots with a traceback to any exception.
The text was updated successfully, but these errors were encountered: