【问题标题】:How to plot from a scatter object on Matlab如何在 Matlab 上绘制散点图
【发布时间】:2018-07-11 07:16:51
【问题描述】:

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

         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 的。但是scatter对象有什么功能呢?

【问题讨论】:

    标签: matlab matlab-figure scatter-plot


    【解决方案1】:

    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.
    

    【讨论】:

    • 为什么Matlab没有设计一个函数来直接绘制散点对象?
    • 不知道。也许保存对象而不是原始数据并使用脚本或函数来重现绘图并不常见。
    • 不知道。也许保存对象而不是原始数据并使用脚本或函数来重现绘图并不常见。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-10-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-07-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多