필터 지우기
필터 지우기

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

조회 수: 99 (최근 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 CenterFile Exchange에서 座標軸の外観에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!