Inconsistent Figure Behavior if Saved While Figure is Visible vs Saved While Figure is Hidden
1 次查看(过去 30 天)
显示 更早的评论
I have run into an issue where I get a different saved png output if I save a figure while it is set to visible compared to when I save the same figure as it is set to invisible. The visibility component is important, as I intent for this section of code to live in a function that will be used in a parfor which by nature does not allow for figures to be visible.
The sample code uses two sets of axes to plot a PNG background image with a geoscatter layer on top of it. The image layer does not seem to be affected by this issue, but the geoscatter shows a change in the point size, a scaling of the colorbar, and a shift of the plotted data between the two methods. This is demonstrated by the two plots saved by the sample code. The first output 'Visible.png' behaves as expected and is exactly what I see if I manually save the figure, but by simply turning off the visibility and resaving this as 'Hidden.png' I get a noticeably different output.
I do not know if this is a bug, or if there is some lower level setting that I am overlooking somewhere. Ive gone through every local resource I have available to me and have so far come up empty.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/625788/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/625793/image.png)
0 个评论
采纳的回答
Walter Roberson
2021-5-21
Some components will not have the correct size calculated until they are rendered by being made visible.
This is a different issue than parfor not being able to display plots. parfor can build plots and set them visible to trigger rendering, but cannot display them to the user.
Also if you need to you could save the parfor generated plots as fig files and then after the parfor do a loop opening the figs and saving to image files.
0 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!