How can I change the thickness or line width of lines, axes, edges of a surface/mesh plot, or the edges of a patch?
202 views (last 30 days)
Show older comments
I am unable to change the LineWidth of dashed(--), dotted(.), or dash-dotted (-.) lines in MATLAB for MS-Windows.
Accepted Answer
MathWorks Support Team
on 24 Feb 2012
Axes, lines, surfaces, and patches all have a 'LineWidth' property. The following describes the effect of the 'LineWidth' on each object:
---------Axes--------
Increases with width of all lines forming the X, Y, and Z axes. Note that this will change the thickness of the grid lines and the box around the 2-D plot. If this effect is not desired (i.e. you wish to only change the thickness of the X-axis across the bottom of the plot) you may wish to add a line object to the axes with the desired properties.
---------Line---------
Increases the width of the line. Note that if you are using markers, such as 'x', 'o', '*', '.', etc., you should use the MarkerSize property to adjust the point size of the markers. Setting the LineStyle produces undesired results.
-------Surface-------
Increases the width of the edges.
--------Patch--------
Increases the width of the edges.
---------------------
For example, to increase the size of the border around a patch object, do the following:
h = fill([1 1 2 2],[1 2 2 1],'r');
set(h,'LineWidth',10)
axis([0 3 0 3])
To increase the linewidth of the line object, do the following:
h = line([1 2],[4 7],'linestyle','--')
set(h,'LineWidth',1.2)
To increase the linewidth of a surface object, do the following:
h = surf(peaks)
set(h,'LineWidth',1.5)
Note the following limitation of MS-Windows:
"The specification for the graphics driver function CreatePen states that broken line styles are not supported for line widths greater than one."
0 Comments
More Answers (0)
See Also
Categories
Find more on Surface and Mesh Plots in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!