Saving plot in coloful png format

1 次查看(过去 30 天)
__Hi dear MathWorks staff and other matlab users. I made calculation using MATLAB and got figure with contourf plot. In figure i see filled colorful plot. But when i try to save (file-save as) it in png format, i get plot in black and white. Can you explain me, what is my error? I attached matlab figure ive got. Thanks in advance.
__P.S. Thank you Stephen Cobeldick. You are right - i confused two companies. Now i corrected my post...
  5 个评论
Walter Roberson
Walter Roberson 2015-10-16
However you would not get the white background the same way.
Marat Zhe
Marat Zhe 2015-10-16
编辑:Marat Zhe 2015-10-16
I am new here and i haven't noticed valuable answers down this page.
I saw only comments.....
Thanks to all participants, who discussed question.

请先登录,再进行评论。

采纳的回答

Walter Roberson
Walter Roberson 2015-10-16
I was testing in R2014a, which is important because graphics changed in R2014b in ways that matter to this situation.
In R2014a (and earlier) when you select save as for PNG, the renderer gets switched to OpenGL from Painters. There is then a conflict in the layering between the rectangle with 'facecolor', 'w', and the contour plot: both of them are in the plane z = 0, so the renderer has to decide which has priority. In Painters the rule is "whichever one was drawn last", but in OpenGL the rules are more complicated. The OpenGL rules tend to prioritize lines over surfaces, which is why the lines show up. But with coplanar surfaces, I do not recall what the rule is.
For R2014a or earlier, you are going to have to push the rectangle into negative Z or pull the contour plot into positive Z. You can use a hgtransform to parent the object, with makehgtform with a Z translation as the Matrix. Or you could replace the rectangle with a patch that had a negative Z. (The purpose of the rectangle() being essentially to provide the white background and the circular edge drawing.)
For R2014b or later, you have another option: you can also use the new SortMethod property, which is discussed in Mike's blog . Watch out for the limitation discussed at the bottom about "some graphics cards" and about PDF.
The more robust method is to ensure that the contours are "above" the rectangle, even if only a tiny bit.

更多回答(1 个)

Image Analyst
Image Analyst 2015-10-16

类别

Help CenterFile Exchange 中查找有关 Lighting, Transparency, and Shading 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by