Why does LineWidth not change when I set the LineWidth property of my plot?
14 views (last 30 days)
Show older comments
Why is there no difference in the linewidth shown below?
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)
Accepted Answer
MathWorks Support Team
on 27 Jun 2009
This issue has to do with the fundamental resolution of your screen. Based on the description of the linewidth property:
<http://www.mathworks.com/access/helpdesk/help/techdoc/ref/line_props.html>
Which says that 1 point = 1/72 inches. We also know that the ScreenPixelsPerInch which is a fundamental property of your screen can be found by performing a GET operation as follows:
get(0,'ScreenPixelsPerInch')
With this information you can obtain Pixels/Point [Dividing Pix/Inch by Points/Inch].
So for the change in Line Width to occur the number of Pixels/Point would need to be a whole pixel before change is noticed.
Illustrative Example:
close all
subplot(2,1,1)
h1 = plot(1:10);
set(h1,'LineWidth',1.1)
subplot(2,1,2)
h2 = plot(1:10);
Line_Width = 1.0;
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 Comments
More Answers (0)
See Also
Categories
Find more on Data Distribution Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!