如何在Matlab上从散点图绘制

时间:2018-07-11 07:16:51

标签: matlab matlab-figure scatter-plot

我有一个分散的对象,想查看它,但是没有找到合适的函数来实现。我只知道它具有以下属性:

         Marker: 'o'
MarkerEdgeColor: 'none'
MarkerFaceColor: [0.6350 0.0780 0.1840]
       SizeData: 36
      LineWidth: 0.5000
          XData: [1×482 double]
          YData: [1×482 double]
          ZData: [1×0 double]
          CData: [0.6350 0.0780 0.1840]

那么我该如何检索该对象的图像? 我知道view()是用于clustergram的。但是散布对象有什么功能?

1 个答案:

答案 0 :(得分:0)

Matlab的scatter不支持使用对象作为输入:

scatter(X,Y) draws the markers in the default size and color.
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.

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

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

如果您有一个散布对象,则可以手动对其进行绘制或重新分配父属性:

o = scatter(rand(20,1),rand(20,1),12,lines(20),'*');
class(o) % it's 'matlab.graphics.chart.primitive.Scatter'

% manually plot the object
figure
scatter(o.XData,o.YData,o.SizeData,o.CData,o.Marker,'LineWidth',o.LineWidth)

% or reassign the parent property
figure
h = axes();
set(o,'Parent',h); % assign o's new parent.