exportgraphics overlay bug when saving

3 views (last 30 days)
Marine Fourrier
Marine Fourrier on 18 Oct 2021
Answered: Richard Quist on 24 Nov 2021
Hello,
I'm using exportgraphics to save my figures in high quality. However they do not save in the same manner as they display.
I joined a screenshot of what the figure looks like when it's produced (before saving), and the purple star and red triangle are on top of all the other markers. I payed attention to the order with which I was plotting the different datasets to have them on top. However when I save the figure, the red triangle is behind the other markers. (see png of the screenshot and pdf of the saved figure).
Any ideas on why the display changes and how to fix it ?
Here is the line of code I use to save the figure
exportgraphics(fig,[REPS.rep_out,'fig_map.pdf'],'ContentType','vector','BackgroundColor','none')
Thanks a lot

Answers (1)

Richard Quist
Richard Quist on 24 Nov 2021
I suspect you're seeing a difference in behavior between the painters renderer (used when generating "true vector" output when ContentType is 'vector') and the onscreen OpenGL renderer. Setting the onscreen figure renderer to painters will likely show the same issue, but then you can try adjusting the line to raise the marker up, perhaps by setting the ZData of the line that has the red marker

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!