How to set the line type and color of the curve drawn by MATLAB?


The curve drawn in MATLAB wants to change the solid line into dotted line and star line and change the color of the line, how to operate? Now let’s take a look at the detailed tutorial.

Software name:
Mathematics software MATLAB r2015b 32-bit complete Special Edition (with cracking file + key + installation tutorial)
Software size:
Update time:
2016-11-23Download now

1. The following will take a simple drawing operation as an example. Draw sine cosine function in the range of 0 to 2 * PI,The default graph is a solid lineThe first color is blue, the second is red

2. Set linetype: when writing drawing code,Set a specific linetype,For example, draw a dotted line:plot(x,y1,’–‘)

3. Draw the star line:plot(x,y1,’p’)Similarly, ‘*’, * line ‘<‘  , Triangle symbol line and so on

4. Set line color:  plot(x,y1,’r’)。Similarly, the symbols of various colors and lines are given in the second figure.

5. In addition, we can set both the linetype and color in one command. plot(x,y1,’–*r’)。

The above is the way to change the type and color of curves and lines in MATLAB. I hope you like it. Please continue to pay attention to developer.

Related recommendations:

How to extract three kinds of RGB color of picture with MATLAB?

How to draw 3D contour graph with MATLAB 2016?

How to show or hide the grid in the coordinate axis in MATLAB?