Color line of the plot drawing

Source: Internet
Author: User

(MatLab) color line of plot drawing

 
Y yellow-dotted line
M pink ○ circle
C bright blue line
R red + + LINE
G green-solid line
B blue * Star Line
W white: dotted line
K black -.
-- Dashes
Php6.1 linear:
[+ | O | * |. | x | square | diamond | v | ^ | >|<| pentagram | hexond]

Square
Diamond
Pentagram
Hex hexagonal star

Usage

Grid open gridline -- dotted line
The hold on command is used to add a new image to a drawn image.
1 x =. 1000; % 0 to 10 X coordinates of the 0.001 points (draw a point every)
Y = sin (x); % corresponds to the Y coordinate
Plot (x, y); % plot
Note: MATLAB drawing is actually a line drawing, so if the point is unencrypted, it will become a line chart. Please test it.
2 y = sin (10 * X );
Plot (X, Y, 'r: ', X, Y,' B ') % draws two functions at the same time
3. To change the color, add the corresponding string to the coordinate pair:
X = 0: 0. 0: 10;
Plot (x, sin (x), 'R ')
4 if you want to change the color and line style at the same time, add the relevant strings to the coordinate pairs:
Plot (x, sin (x), 'r *')
5. Use the axis ([xmin, xmax, ymin, Ymax]) function to adjust the image axis range.
Axis ([1.5,-, 1])
6 MATLAB can also add various annotations and processing to the image: (see the table above)
Xlabel ('x axis '); % x axis Annotation
Ylabel ('y axis '); % Y axis Annotation
Title ('cosine function'); % graphic title
Legend ('y = cos (x) '); % graphical Annotation
Gtext ('y = cos (x) '); % graphical annotation, locate the annotation position with the mouse
Grid on; % display grid lines
7. Draw an ellipse
A = [0: PI/50: 2 * Pi] '; % Angle
X = cos (a) * 3; % Parameter Equation
Y = sin (a) * 2;
Plot (x, y );
Xlabel ('x'), ylabel ('y ');
Title ('elliptical ')
8. Plot the curve when the function is 0 ≤ x ≤ 1.
X = 0: 0. 1:1
Y = x. * exp (-x) % why do I use vertex operations? What if I don't need it?
Plot (x, y), xlabel ('x'), ylabel ('y'), title ('y = x * exp (-x )')
9 draw the attenuation oscillation curve and its envelope line. The value range of T is [0, 4 π].
T = 0: PI/50: 4 * PI;
Y0 = exp (-T/3 );
Y = exp (-T/3). * sin (3 * t );
Plot (T, Y, '-R', T, y0,': B ', T,-y0,': B ') %-r indicates the red solid line ,: B Indicates the blue dot line. See the table above.
Grid
10. Create several coordinate systems on the same image and use the subplot (m, n, p) command to divide the image into m × n graphic regions. P represents the current region number, draw a chart in each area, as shown in figure
X = linspace (0, 2 * Pi, 30); y = sin (x); Z = cos (X );
U = 2 * sin (x). * Cos (x); V = sin (x)./cos (X );
Subplot (2, 2, 1), plot (x, y), axis ([0 2 * pi-1 1]), title ('sin (x )')
Subplot (2, 2), plot (x, z), axis ([0 2 * pi-1 1]), title ('cos (x )')
Subplot (2, 2, 3), plot (x, u), axis ([0 2 * pi-1 1]), title ('2sin (x) Cos (x )')
Subplot (2, 2, 4), plot (x, v), axis ([0 2 * pi-20 20]), title ('sin (X)/cos (X) ')


Color line of the plot drawing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.