iMatlab

爱学习,爱Matlab

matlab中的scatter函数(可画散点图)

scatter Scatter/bubble plot.

    scatter(X,Y,S,C) displays colored circles at the locations specified

    by the vectors X and Y (which must be the same size).  

 

    S determines the area of each marker (in points^2). S can be a

    vector the same length a X and Y or a scalar. If S is a scalar, 

    MATLAB draws all the markers the same size. If S is empty, the

    default size is used.

    

    C determines the colors of the markers. When C is a vector the

    same length as X and Y, the values in C are linearly mapped

    to the colors in the current colormap. When C is a

    length(X)-by-3 matrix, it directly specifies the colors of the  

    markers as RGB values. C can also be a color string. See ColorSpec.

 

    scatter(X,Y) draws the markers in the default size and color.

    scatter(X,Y)是个典型的用法,画散点图。后面有离子,可以设置相关的颜色,点的形状。

    scatter(X,Y,S) draws the markers at the specified sizes (S)

    with a single color. This type of graph is also known as

    a bubble plot.

    scatter(...,M) uses the marker M instead of 'o'.

    可以在后边填上所绘点的类型,不一定非是圆形的点。

    scatter(...,'filled') fills the markers.

    加入filled可以让图中的点变成实心点。

    scatter(AX,...) plots into AX instead of GCA.

 

    H = scatter(...) returns handles to the scatter objects created.

 

    Use PLOT for single color, single marker size scatter plots.

 

    Example

tx=[1.0;14.0;3.0;21.0;9.0;22.0;10.0;3.0;27.0;20.0;18.0];

ty=[7.0;3.0;19.0;18.0;33.0;3.0;11.0;32.0;27.0;12.0;34.0];

scatter(tx,ty,'filled','r');

hold on

kx=[4.40;4.87;0.63;8.26;4.29;8.24;3.17;0.94;11.23;6.82;5.58];

ky=[5.55;1.14;6.20;5.84;10.34;0.49;3.88;10.89;9.20;4.29;10.62];

scatter(kx,ky,'b','*');



评论

热度(1)