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

72 ビュー (過去 30 日間)
MathWorks Support Team
MathWorks Support Team 2012 年 12 月 26 日
以下のコードで二つの 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)

採用された回答

MathWorks Support Team
MathWorks Support Team 2012 年 12 月 26 日
この問題は、スクリーンの解像度が影響しております。そのため、ご使用のスクリーンの解像度によっては 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
% -------------------------------------------

その他の回答 (0 件)

カテゴリ

Help Center および File Exchange座標軸の外観 についてさらに検索

Community Treasure Hunt

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

Start Hunting!