plot linewidth of 1 in matlab

To plot a line with linewidth of 1 in MATLAB, you can use the "LineWidth" parameter in the "plot" function, like this example:

main.m
x = linspace(0,10,100);
y = sin(x);
plot(x, y, 'LineWidth', 1)
63 chars
4 lines

In this example, the "plot" function is used to plot the sine function from 0 to 10, with 100 points. The "LineWidth" parameter is set to 1, which determines the thickness of the line.

You can also set the default linewidth using the "DefaultLineLineWidth" property of the current axes, like this:

main.m
set(gca, 'DefaultLineLineWidth', 1)
36 chars
2 lines

This will set the default linewidth to 1 for all subsequent plots on the current axes.

related categories

gistlibby LogSnag