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

SVG rendering artifacts #809

Open
sjanssen2 opened this issue Sep 30, 2022 · 5 comments
Open

SVG rendering artifacts #809

sjanssen2 opened this issue Sep 30, 2022 · 5 comments

Comments

@sjanssen2
Copy link

sjanssen2 commented Sep 30, 2022

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

@antgonza
Copy link
Collaborator

antgonza commented Oct 3, 2022

I think this is a duplicate of #736, right?

@ElDeveloper
Copy link
Member

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
Copy link
Member

@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?

@sjanssen2
Copy link
Author

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

@ElDeveloper
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants