Effacer les filtres
Effacer les filtres

Why is the patch function modifying the line width of existing lines?

5 vues (au cours des 30 derniers jours)
Ana
Ana le 9 Juin 2015
Commenté : Tong Zhao le 29 Juil 2022
Hello all, I am having some trouble with the patch function, whenever I use it it is changing the line width (at least apparently) of already existing lines. Here is a code example:
t=0:0.01:4
figure
plot(t,t.^2)
hold on
plot([1,1],[0,16],'--r','LineWidth',2)
plot([2,2],[0,16],'--r','LineWidth',2)
plot([3,3],[0,16],'--r','LineWidth',2)
patch([1,1,2,2],[0,16,16,0],'b','FaceAlpha',0.1,'LineStyle','none')
Before the patch command, the lines have a specific width, but after it they change! Has someone faced this problem before? Is there any solucion to it?
Thank you very much in advance,
Ana

Réponse acceptée

Walter Roberson
Walter Roberson le 9 Juin 2015
When you add the patch() the renderer changes to OpenGL, as only OpenGL can handle transparency (FaceAlpha).
  6 commentaires
Tong Zhao
Tong Zhao le 29 Juil 2022
@Bruno Luong thank you! It worked.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Lighting, Transparency, and Shading dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by