use "set" with trasparent color
6 ビュー (過去 30 日間)
古いコメントを表示
selected = findobj(allLines,'Type','line','LineWidth',0.5);
set(selected, 'MarkerFaceAlpha',.2,'MarkerEdgeAlpha',.2);
Error using matlab.graphics.chart.primitive.Line/set
Unrecognized property MarkerFaceAlpha for class Line.
Error in mycallback (line 19)
set(selected, 'MarkerFaceAlpha',.2,'MarkerEdgeAlpha',.2);
Error while evaluating Line ButtonDown
Hi, i try to color in trasparente mode but i get error
0 件のコメント
採用された回答
Matt J
2025 年 6 月 7 日
編集済み: Matt J
2025 年 6 月 7 日
It's undocumented, I believe, but you can control line transparency by setting the Color property to a 4-element RGBA value.
h=plot(rand(5,2),'r', 'LineWidth',4);
set(h(2),'Color',[1,0,0, 0.2]);
3 件のコメント
Walter Roberson
2025 年 6 月 7 日
Note:
If you serialize a plot (such as save and restore, or send it between parallel workers), then the transparancy set in this manner will be discarded.
その他の回答 (1 件)
Walter Roberson
2025 年 6 月 7 日
Line objects have never supported MarkerFaceAlpha or MarkerEdgeAlpha
MarkerFaceAlpha and MarkerEdgeAlpha are used for Scatter plots.
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
