stem plot line width inconsitencies

1 回表示 (過去 30 日間)
dormant
dormant 2023 年 10 月 19 日
コメント済み: Voss 2023 年 10 月 25 日
I can't understand why I can't set the line width consistently with the stem plot.
I am plotting four subplots in a loop and this is the relevant bit of the code:
for ista = 1:nsta
[stuff here]
subplot(nsta,1,ista);
stem( datimAuto, triggersAuto, 'r', 'Marker', 'none', 'LineWidth', 2.0 );
xlabel( 'Date' );
title( sta );
xlim( [plotBeg plotEnd] );
grid on;
[stuff here]
end
In the resulting plot, the second subplot has thicker lines. This has less data than the other three, but I don't see why that would affect it.
Any ideas?
  1 件のコメント
Adam Danz
Adam Danz 2023 年 10 月 19 日
If you save the figure and attach the .fig file, I'd be happy to look into it.

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

採用された回答

Voss
Voss 2023 年 10 月 19 日
Seems like a renderer issue. You can try switching to the 'painters' renderer. You can see in the tests below that only the 'painters' renderer draws the lines with the same apparent thickness.
data1 = 400*rand(1,150);
data2 = 1000*rand(1,300);
renderers = {'opengl','zbuffer','painters'};
for ii = 1:numel(renderers)
f = figure('Position',[1 1 1200 600],'Renderer',renderers{ii});
subplot(2,1,1)
stem(151:300,data1,'r','Marker','none','LineWidth',2.0)
xlim([1 300])
title(sprintf('''%s'' Renderer',renderers{ii}))
subplot(2,1,2)
stem(1:300,data2,'r','Marker','none','LineWidth',2.0)
xlim([1 300])
end
  2 件のコメント
dormant
dormant 2023 年 10 月 25 日
編集済み: dormant 2023 年 10 月 25 日
Thanks. You were right. Painters works.
But for how long? This warning message is a bit vague!
Voss
Voss 2023 年 10 月 25 日
Glad it's working. I don't know what The Mathworks future plans are for figure Renderers (just never upgrade your MATLAB version and this will continue to work!).

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

その他の回答 (0 件)

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

タグ

製品


リリース

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by