Skip to content
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

Massive size on save to svg - vectors of sector borders and some other lines have tons of nodes #56

Closed
dnjst opened this issue Feb 17, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@dnjst
Copy link

dnjst commented Feb 17, 2024

example01-inkscape-nodes

Hello! I would like to save pycirclize plots to svg to submit for publication in vector format (required for the journal).

I found that upon saving to svg, the output files are massive and unwieldy in any editor. The .svg is >1 MB.

Opening the .svg file in inkscape, I found that the black borders around the sector are being rendered as hundreds of tiny points, rather than as a continuous curve in the vector.

Is there any way the code can be adjusted so that it can save to vector in a more efficient way? Arrows and links seem to work fine, it is just those border boxes so far as I can tell.

To reproduce, you can use the Example 1. Circos Plot and change the save command to:

circos.savefig("example01.svg")

This also occurs in phylogenetic trees, where the lines consist of more nodes than should be necessary (although I am unsure about how vector rendering works):

example04

Thank you so much for this program which renders really compelling images.

@dnjst dnjst changed the title Massive size on save to svg - vector of sector borders has tons of nodes Massive size on save to svg - vectors of sector borders and some other lines have tons of nodes Feb 17, 2024
@moshi4 moshi4 mentioned this issue Feb 18, 2024
@moshi4
Copy link
Owner

moshi4 commented Feb 18, 2024

Hi @dnjst,

I did not notice the large SVG file size because I did not check the SVG output results of pyCirclize very often. The problem was caused by too many points to represent a curve with a particular vector object.

In the newly released pyCirclize v1.3.0, the number of points to represent a curve has been reduced to one-tenth, resulting in a smaller output SVG file size. I am not sure if it will be small enough for you, but it will certainly be smaller than before.

@moshi4 moshi4 closed this as completed Feb 19, 2024
@moshi4 moshi4 added the enhancement New feature or request label May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants