explain ax.gridlinestyle='-'; in matlab

ax.gridlinestyle = '-' sets the line style for grid lines in a plot to a solid line style. The variable ax refers to the Axes object on which the plot is being drawn.

For example, the following code creates a plot and sets the style of the grid lines to solid lines:

main.m
x = 1:10;
y = sin(x);
plot(x,y);

ax = gca;
ax.gridlinestyle = '-';
68 chars
7 lines

This code will create a plot of the sin function and add solid grid lines to both the x- and y-axes.

related categories

gistlibby LogSnag