Patch object in logarithmic scale

36 views (last 30 days)
Dear all, when I change the axes scale from linear to log, a colored polygon (usually drawn by patch or fill) is not colored any more. Why and how can I avoid it?
Regards, Maurizio

Accepted Answer

Walter Roberson
Walter Roberson on 2 Feb 2012
If I recall correctly, fill creates patches; I am not sure about that.
If a patch object has any point which is 0 or negative on an axis, then when that axis is changed to log scale, the internal patch render algorithms give up trying to color it. This is the case even if the point is not within the current axis limits.
The work-around is not to use a non-negative coordinate -- even if it is eps() or even 1E-100, any non-negative value should do.
You might perhaps also be able to get around the problem by setting the figure rendering property to 'painters' or 'zbuffer'; I only routinely use OpenGL so I am not certain if the problem applies to the other renders.
  1 Comment
Maurizio De Pitta'
Maurizio De Pitta' on 2 Feb 2012
Thanks Walter.
Indeed a work around is to carefully check that data are nonzero (i.e. strictly >0). Indeed mine were not, but I forgot to check them before. Dummy mistake. Sorry about it.
Maurizio.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!