LineWidth

Width of lines

MuPAD® notebooks will be removed in a future release. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.

Value Summary

InheritedPositive output size

Description

LineWidth sets the width of line objects such as 2D function graphs, curves in 2D and 3D, arrows, parameter lines on surfaces etc.

The value should be specified as an absolute physical length including a length unit such as LineWidth = 1.5*unit::mm. Numbers without a physical unit give the size in mm.

Note that the graphics cannot always react to small changes of the line width because of the discretization into pixels.

One cannot make lines invisible by setting their width to 0. Use LinesVisible = FALSE instead.

LineWidth does not have an effect on the line width of axes and coordinate grid lines. Use the attributes AxesLineWidth and GridLineWidth to manipulate axes and coordinate grid, respectively.

Examples

Example 1

We draw a house with thick walls:

plot(plot::Polygon2d(
     [[0, 0], [0, 3], [2, 5], [4, 3], [0, 3],
      [4, 0], [0, 0], [4, 3], [4, 0] ], 
     LineWidth = 4*unit::mm, Color = RGB::Grey),
     Axes = None):

The building instructions are added by arrows. The drawing order is indicated by the titles of the arrows and their increasing line width:

plot(plot::Polygon2d(
     [[0, 0], [0, 3], [2, 5], [4, 3], [0, 3],
      [4, 0], [0, 0], [4, 3], [4, 0] ], 
     LineWidth = 4*unit::mm, Color = RGB::Grey),
     plot::Arrow2d([0, 0], [0, 3], LineWidth = 0.3*unit::mm,
                   Title = "1", TitlePosition = [0.2, 1.4]), 
     plot::Arrow2d([0, 3], [2, 5], LineWidth = 0.5*unit::mm,
                   Title = "2", TitlePosition = [0.5, 3.9]), 
     plot::Arrow2d([2, 5], [4, 3], LineWidth = 0.7*unit::mm, 
                   Title = "3", TitlePosition = [3.4, 3.9]), 
     plot::Arrow2d([4, 3], [0, 3], LineWidth = 0.9*unit::mm,  
                   Title = "4", TitlePosition = [1.9, 3.2]), 
     plot::Arrow2d([0, 3], [4, 0], LineWidth = 1.1*unit::mm,  
                   Title = "5", TitlePosition = [1.0, 2.5]), 
     plot::Arrow2d([4, 0], [0, 0], LineWidth = 1.3*unit::mm,  
                   Title = "6", TitlePosition = [1.9, 0.2]), 
     plot::Arrow2d([0, 0], [4, 3], LineWidth = 1.5*unit::mm,  
                   Title = "7", TitlePosition = [0.7, 0.9]), 
     plot::Arrow2d([4, 3], [4, 0], LineWidth = 1.7*unit::mm,  
                   Title = "8", TitlePosition = [3.7, 1.4]), 
     Axes = None,
     TipLength = 5*unit::mm
    ):