matlab--Two-dimensional drawing

Source: Internet
Author: User
Tags explode

1. Enter the input form of the point as a vector or matrix . A vector represents a curve. A column of a matrix can be viewed as a vector, so the matrix represents the number of columns.
A real vector, the horizontal axis is the index value of y, and the ordinate is the value of Y.
such as: vector (2,3) on behalf of the point (up) and (2,3)
the real part of the plural is the horizontal axis and the imaginary part as the ordinate.
If the plural 2+3i is the point (2,3)

2. most commonly used two-dimensional graph plotting function plot (x,y,s)
X, y is a real vector or matrix of the same size. X provides the horizontal axis and Y provides the ordinate. S is a string, s used to set some parameters of the curve, such as color, marker, etc.

Other formats

function function
Plot (x, y) X, y is a real vector or matrix of the same size. X provides the horizontal axis and Y provides the ordinate.
Plot (X1,y1,s1,x2,y2,s2,...) Similar to plot (x,y,s), except that you can draw curves with different parameter settings (such as different colors)
Plot (y) Y can be a real vector, a complex vector, a matrix.

3. drawing Sublpot of the sub-graph (m,n,p)
divides the current graphics window into m*n plots and plots in the P plot area .
The numbering of the plot area is numbered by line priority from left to right.
Other formats:
Subplot (MNP) is a comma that can be removed

Draw Straight line ()

function function
Line (x, y) two-dimensional x, y vector or matrix
Line (x, Y, z) three-dimensional x, y, z vector or matrix

Polar coordinates drawing polar (theta,rho,s)
Theta is Radian, Rho is radius, S is set parameter of curve
Other formats: Polar (Theta,rho)

the transformation of polar coordinate and Cartesian coordinates

function function
[x, Y] = Pol2cart (Theta,rho)
[Theta,rho]cart2pol (x, y)

13. Plotting logarithmic and semi-logarithmic coordinates

function function
SEMILOGX (x, y) The x-axis is a logarithmic coordinate
Semilogy (x, y) The y-axis is a logarithmic coordinate
Loglog (x, y) x, y both use logarithmic coordinates

14. Double Y-axis drawing: A common X-axis, with two y-axis plotyy (X,Y,X,Z,S1,S2)
Other formats Plotyy (X,Y,X,Z)

4. draw hold for overlay chart

function function
On Start the graphics hold function
Hold off Turn off the graphics hold function
Hold Switch

5. Set Axis axis

set the representation range of an axis axis ()

function function
Axis ([xmin xmax ymin Ymax]) Two-dimensional graphics
Axis ([xmin xmax ymin ymax zmin Zmax]) Three-dimensional graphics
Axis ([xmin xmax ymin ymax zmin zmax cmin Cmax]) ' Cmin Cmax is a graphic color information

set the display of an axis

function function
Axis off To cancel the display of an axis
Axis on Restore all settings for coordinates
Axis equal Isometric scale for horizontal and vertical axes

set the title of an axis

function function
Xlabel (s)
Ylabel (s)

6. Display grid line grid ()

function function
Grid on Display grid lines
Grid off Suppress gridlines

7. frame box ()

function function
box on Add border lines
Box off Cancel Border Line
Box Switch

8. zooming zoom of a graphic

function function
Zoom (Factor) Facotr scaling as a scaling factor
Zoom on/Off Simultaneous amplification of x, y axes
Zoom Switch
Zoom Out Restore settings for the original axis
Zoom Reset Revert to initial value
Zoom Xon Scale only on the x-axis
Zoom Yon Scale only on the y-axis

9. drag pan with graphics

function function
Pan on
Pan off
Pan
Pan Xon
Pan off

data cursor datacursormode Displays the coordinate values of a point on the selected graph

function function
Datacursormode on/Off

set up a caption for a graphic

function function
Title (s) Set the caption of a graphic

Texlabel (s) converts an expression in MATLAB to a string in text format

function function
Texstring = Texlabel (f) Converts an expression in MATLAB to a string in text format

add legend Legend ()

Display Color Bar Colorbar

text Box Callout

function function
Text (x,y,s) or text (x,y,z,s) Add a callout s in the graph (x, y) or (x, Y, z)
Gtext (' string ') Interactive , labeled location determined by the user

get and Mark data points ginput ()

function function
[x, Y] = Ginput (n) Gets and marks the data point, N is the number of points fetched

. Drawing of Functions

function function
One-dimensional function drawing
Fplot (Fun,limits) For the function fun drawing, the limits is the range of the argument values. The interval of the value points is obtained by the adaptive algorithm, the larger the function changes, the smaller the interval.
Ezplot (Fun,[xmin,xmax])
Binary function drawing
Ezplot (Fun2,[xmin,xmax,ymin,ymax]) Drawing on the two-dollar function fun
Ezpolar (Fun,[a,b]) Polar coordinates drawing
Draw Contours
Ezcontour (Fun) Draw a fun contour
Ezcontourf (Fun) Draw a fun contour and fill it with graphics
Contour (z) Z is the matrix and the contour of the matrix Z is drawn
Contour (x, y, z) Draw the contour of the Matrix Z at (x, y)
Contour (z,n) or contour (x,y,z,n) Draw N Contour Lines
Contourf () Fill version
Bar Chart Bar ()
Vertical direction
Bar (y)/bar (x, y) Draw a bar chart
Bar (x, ' stack ') Draw the sum of the bar chart
Horizontal direction
Barh (y)/Barh (x, y)
Pie chart Pie ()
Pie (x)
Pie (X,explode) Explode is the definition of the part to protrude, in the form of a vector, [0,0,1,0] means 3 points to protrude
Histogram hist ()
hist (y) Histogram of the default 10 bars
hist (y,m) Histogram of M-bars
hist (y,x) X is a vector, and each dimension in X is the number of histogram bars
Area chart
Area (x, y) Fills the area after the equivalent of plot (x, y).
Scatter chart
Scatter (x,y,s,c) S is the size of the scatter point, C is the color of the scatter, and the fille fills the scatter.
Plotmatrix () Plot multiple scatter plots
Error chart
ErrorBar (X,y,e)
Fill chart
Fill (x,y,c)
Match Stick Chart
Stem (x, y)
Ladder diagram
Stairs (x, y)
Compass Map
Compass (u,v) or compass (z)
Feather Chart
Feather (u,v) or feather (z)
vector field diagram
Quiver (X,Y,U,V)
Comet map
Comet (X,y,p) P defaults to 1
Pseudo-Color Drawing
Pcolor (X,y,c) or Pcolor (c)
Graphic handle The most basic, lowest-level unit in a graph.
Set () Set property values for a graphics handle
Get () Get property values for a graphics handle
GCF () Get a graphics handle
Axis handle
Set () Set property values for an axis handle
Get () Get property values for an axis handle
GCA () Get axis handle

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.