emperor icon indicating copy to clipboard operation
emperor copied to clipboard

SVG rendering artifacts

Open sjanssen2 opened this issue 3 years ago • 5 comments

I am using qiime2-2022.8. When exporting an SVG from an Emperor plot, and loading the resulting SVG in e.g. Inkscape, I do see ugly artifacts: image It is reproducible with other graphics editors lile sK1 image or Firefox (slightly different view to show that not only spheres are affected) image

Usually, I am using Ubuntu 20.04, but I also used OSX 10.13 qiime2 for generating the qzv file with the same artifacts.

I am attaching emperor plots generated from both OS (note I had to change file ending into *.zip) and the exported SVG emp_osx.zip emp_linux.zip

emperor-image

P.S. same artifacts show up, when exporting the SVG within OSX/Chrome

sjanssen2 avatar Sep 30 '22 11:09 sjanssen2

I think this is a duplicate of https://github.com/biocore/emperor/issues/736, right?

antgonza avatar Oct 03 '22 12:10 antgonza

I think they are different(?). The first screenshot from @sjanssen2 shows stars on the vertices of the polygins, and #736 only shows the polygons (which are to be expected).

ElDeveloper avatar Oct 06 '22 16:10 ElDeveloper

@sjanssen2 Thanks again for reporting. Just had a chance to look into this. When I load the SVG file you uploaded I can see the artifacts. However, when I generate an SVG file using the EMPeror plot available in the view.qiime2.org homepage, I can't reproduce the issue.

The following two screenshots of Inkscape show the file you shared (with the artifacts), and a new file I generated (without the artifacts):

With Artifacts

Screen Shot 2022-10-11 at 3 45 13 PM

Without Artifacts

Screen Shot 2022-10-11 at 3 45 14 PM

I also tried generating an SVG file with the QIIME2 artifacts you uploaded however I wasn't able to reproduce the problem. My guess is this has something to do with the browser versions you are running. Would you mind sharing what those versions are?

ElDeveloper avatar Oct 12 '22 01:10 ElDeveloper

sorry for the late reply. I am using image

To rule out issues with my browser or OS, I also did the same on an OSX in a virtual box via Chrome - exported the SVGs there and opened them with Inkscape within OSX - but got the same issues

sjanssen2 avatar Oct 19 '22 13:10 sjanssen2

Thanks, I just tried that exact same version and was able to reproduce the issue. I think we need to update THREE.js and the SVGRenderer class. Seems like there's a numerical precision issue where the triangles that make up the shapes are computed with a good bit of error when the triangles are small but if the triangles are large then you won't really observe this problem (unless you zoom in a lot). That is why I wasn't able to reproduce this before (I think).

To reproduce the error, save an SVG file of a plot with all spheres at a relatively small size, then open in Inkscape and zoom in ~2000%. You should be able to see that each shape has those artifacts around the vertices.

ElDeveloper avatar Oct 20 '22 20:10 ElDeveloper