如何从 Matlab 上的散点对象绘图

How to plot from a scatter object on Matlab

我有一个散点对象,想查看它,但没有找到合适的函数来执行此操作。我只知道它有以下属性:

         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。但是散点对象有什么作用呢?

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.