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

10 ビュー (過去 30 日間)
Ana
Ana 2015 年 6 月 9 日
コメント済み: Tong Zhao 2022 年 7 月 29 日
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

採用された回答

Walter Roberson
Walter Roberson 2015 年 6 月 9 日
When you add the patch() the renderer changes to OpenGL, as only OpenGL can handle transparency (FaceAlpha).
  6 件のコメント
Bruno Luong
Bruno Luong 2022 年 7 月 29 日
patch(..., 'LineWidth',2)
Tong Zhao
Tong Zhao 2022 年 7 月 29 日
@Bruno Luong thank you! It worked.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangePolygons についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by