Effacer les filtres
Effacer les filtres

Shading of viscircles weird behavior

24 vues (au cours des 30 derniers jours)
ludolfusexe
ludolfusexe le 15 Juil 2024 à 12:18
Commenté : ludolfusexe le 16 Juil 2024 à 5:35
When I export a figure via
exportgraphics(axis,filename);
multiple times, I get the strange behavior that after some exports circles drawn via
viscircles(axis,[x, y],r,'EnhanceVisibility',true);
are shaded white (just the white circle remains which is shaded to improve visibility).
This worked fine for weeks, but now I added the yellow surface-plot below and now this behavior appears.
Can someone explain why this happens and what to do that the export works (while 'EnhanceVisibility', true remains)?
  1 commentaire
Milan Bansal
Milan Bansal le 15 Juil 2024 à 14:16
Can you please provide the code to reproduce the issue.

Connectez-vous pour commenter.

Réponse acceptée

Walter Roberson
Walter Roberson le 15 Juil 2024 à 20:58
viscircles() uses 2D coordinates, with an implicit ZData of 0.
When you draw a surface, the surface has 3D coordinates.
When 2D data and 3D data are mixed, there are several possible outcomes:
  • the object that is drawn later "wins" at Z coordinate 0
  • the 3D object "wins" at Z coordinate 0
  • the 2D object "wins" at Z coordinate 0
  • the 2D object "wins" everywhere, drawn "on top" of the 3D object no matter what the 3D coordinates are
  • the 3D object "wins" everwhere, hiding the 2D object everywhere
In practice, this is controlled by the axes SortMethod property
the default of which is "depth". But "depth" doesn't talk explicitly about what happens for 2D objects (are they treated as 3D with Z = 0?) versus 3D objects, and does not talk explicitly about what happens when there is a surface and a line at the same depth. In practice 2D objects are not always treated the same way as Z = 0...
To be safer, you should switch your viscircles() into plot3() calls with Z = 0.
  2 commentaires
ludolfusexe
ludolfusexe le 16 Juil 2024 à 5:33
Thank you for your explanation.
FYI, all z-codinates of the surface-plot are negative, only the order of the internal viscircles circles seems to be confused by the surface-plot.
I will probably replace viscircles with my own method as you suggested, thank you very much.
ludolfusexe
ludolfusexe le 16 Juil 2024 à 5:35
This behavior does not occur in normal plots in the matlab figure, only in the automatically exported png image.

Connectez-vous pour commenter.

Plus de réponses (0)

Tags

Produits


Version

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by