Filter löschen
Filter löschen

LineWidth プロパティの値を変更​しても線の太さが変わ​らないのはなぜですか​?

99 Ansichten (letzte 30 Tage)
MathWorks Support Team
MathWorks Support Team am 26 Dez. 2012
以下のコードで二つの SUBPLOT を作成しています。二つの図中の線は異なった太さを指定していますが、同じ太さになっています。この理由を教えてください。
subplot(2,1,1)
h1 = plot(1:10);
set(h1,'LineWidth',1.1)
subplot(2,1,2)
h2 = plot(1:10);
set(h1,'LineWidth',1.4)

Akzeptierte Antwort

MathWorks Support Team
MathWorks Support Team am 26 Dez. 2012
この問題は、スクリーンの解像度が影響しております。そのため、ご使用のスクリーンの解像度によっては PLOT での線の細かい設定ができない場合があります。
以下、線の太さをどれくらい細かく設定できるかどうかを調べる方法についての説明になります。
MATLAB のコマンドウィンドウから
get(0,'ScreenPixelsPerInch')
を実行してご使用のスクリーンの pixel/inch を確認することができます。また、1ポイント = 1/72 インチ なので、
72 points/inch
となります。これらの結果より、たとえば上記の GET の結果が 96 である場合、
96/72 = 1.333 pixels/point
となります。この pixels/point の値が切捨てで 1 の間は同じ太さとなり、2、3、と増えるにつれ、線の太さが太くなります。
以下のプログラムを実行することで、どの LineWidth で太さが変わるか分かります。
% -------------------------------------------
close all
subplot(2,1,1)
h1 = plot(1:10);
set(h1,'LineWidth',1.1)
title('pixel width points')
subplot(2,1,2)
h2 = plot(1:10);
Line_Width = 1.0;
title('line width')
for i = 1:100
clc
Pixels_Per_Point = (get(0,'ScreenPixelsPerInch')/72);
subplot(2,1,2)
set(h2,'LineWidth',Line_Width)
Pixel_Width_Pts = Pixels_Per_Point*Line_Width
Line_Width = Line_Width + 0.1
pause
end
% -------------------------------------------

Weitere Antworten (0)

Kategorien

Mehr zu 座標軸の外観 finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!