Export layering issue when exporting figures with multiple lines as pdfs

3 次查看(过去 30 天)
I am working on making publication ready figures for a paper in Matlab (2017 or 2018 I believe), and I'm having difficulty with Matlab exporting graphics objects with weird/wrong layering when exported in vector formats. Below I've included two pictures, one a png export from Matlab with the correct layers: quiver on top of lines, lines in this order: cyan, light blue, blue. Then a screenshot of a Matlab export to pdf. As you can see, the pdf looks a lot nicer, but the layers are all over the place. For instance the quivers that should be on top is getting covered up by objects below it, and the line on top is actually not consistent, sometimes its cyan and sometimes its light blue. This is all in spite of setting uistack for the quiver to 'top' and the others appropriately.
I do have a workaround for this issue, but it's tedious, so I wanted to also ask the community if they know why this happens to save time for others. The solution I came up with was to set the "ZData" for all the objects such that the object on top had the highest z values, and so on. Why this should work when uistack does not, I have no idea.
The expected layering obtained by exporting a png. Low quality, but the layering is right.
The erroneous layering obtained by exporting a pdf. Higher quality, but the layering is wrong.
I believe I've seen people asking about this type of issue before, but I have never seen an answer to it. I know I've seen at least one thread from 2014 with a similar issue and no answers. However, it can be irritating so I wanted to ask if anyone knew why it happens.

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

产品


版本

R2017b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by