【问题标题】:Multi-dimensional data plotting多维数据绘图
【发布时间】:2017-05-18 05:12:43
【问题描述】:

我有一个数据集,其中每个观察(由 ID 标识)都有多个 (4+) 度量。每个度量都有一个全局截止值:每个度量一个,它适用于所有观察。我想在图表上可视化这些数据点,包括截止值,以便可以快速识别超过截止值的数据点。

在二维图上,这可以通过散点图和代表截止值的线轻松完成,但在多维情况下看起来并不那么容易。

我已经研究过雷达和极坐标图。它们的问题是每个观测值 (ID) 被多次表示,因此很难看出哪些点超过了至少一个度量的截止值。

    ID  Measure         Value
    1   Avg Size        100
    1   Max Throughput  1000
    1   Inc Diff        1.56
    1   Max Value       10000000
    2   Avg Size        150
    2   Max Throughput  1500
    2   Inc Diff        2.4
    2   Max Value       10000000
    3   Avg Size        250
    3   Max Throughput  900
    3   Inc Diff        0.5
    3   Max Value       15000000

技术解决方案不是特别相关。我试图在 SAS 中实现这一点;有许多有趣的 JavaScript 图表库,它们也可以使用。

我正在寻找多维(4+ 维)场景中的可视化示例。

【问题讨论】:

  • 对于只是松散相关的多个度量,我建议创建多个图表的面板、网格或网格(每个度量一个或多个)。在 SAS 中,您可以查看 proc sgpanel

标签: javascript plot charts sas


【解决方案1】:

你并不孤单!

这是我正在使用的模拟数据:

/*Simulate reproducible random data. Six dimensions.*/
data have;
    do id=1 to 20;
        measure_1 = ceil(ranuni(_N_    )*10   );
        measure_2 = ceil(ranuni(_N_+20 )*100  );
        measure_3 = ceil(ranuni(_N_+40 )*1000 );
        measure_4 = ceil(ranuni(_N_+60 )*10000);
        measure_5 = ceil(ranuni(_N_+80 )*1000 );
        measure_6 = ceil(ranuni(_N_+100)*100  );
        output;
    end;
run;

我没有表示截断值,但您可以使用注释表示一些尺寸截断值。下面是一种至少表示5个维度的方法(ActiveX交互图,用IE查看):

/*Visually represent 5 of the 6 dimensions, however visualizing the thresholds is hard.*/
data have_prepare;
    set have;
    length measure_3_color $8;
    measure_2_size  = measure_2/50;
    measure_3_color = cats("CX",put((measure_3/1000)*256,hex2.),'FF',put(256-(measure_3/1000)*256,hex2.));
run;

/*Output Java ActiveX graph for user manipulation.*/
ods html file="C:\test_activex.html";
goptions reset=all device=activex 
         border xpixels=600 ypixels=400 
     cback=white;  
title1 "5 dimension representation";
title2 "Measures 4 to 6 are spatial, Measure 2 is shape size, Measure is color";
title3 "Right-click to use the 'Graph Toolbar'";
proc g3d data=have_prepare;
  scatter measure_4*measure_5=measure_6 / noneedle
     color=measure_3_color
     size=measure_2_size
     shape="BALLOON";
run;
quit;
ods html close; 

如果您愿意采用不那么花哨的方法来查看数据,则只需使用 proc printproc format (more detail here),即可根据需要为任意多个维度提供交通信号灯:

/*Using PROC PRINT with traffic lighting could work?*/
/*Create formats to color cell backgrounds corresponding to values outside predetermined cut-offs*/
proc format;
    value m1_thresh_bg_fmt  low-8   = 'white'
                            9-high  = 'red';

    value m2_thresh_bg_fmt  low-75  = 'white'
                            76-high = 'red';

    value m3_thresh_bg_fmt  low-100  = 'CX0000FF' /*blue*/
                            101-900  = 'CXFFFFFF' /*white*/
                            901-high = 'CXFF0000' /*red*/;

    value m4_thresh_bg_fmt  low-2000  = 'red'
                            2001-high = 'white';

    value m5_thresh_bg_fmt  low-60  = 'red'
                            61-high = 'white';

    value m6_thresh_bg_fmt  low-90  = 'white'
                            91-high = 'red';
run;

ods html file="C:\test_print.html";
proc print data=have noobs;
    var id;
    var measure_1 / style(data)={background=m1_thresh_bg_fmt.};
    var measure_2 / style(data)={background=m2_thresh_bg_fmt.};
    var measure_3 / style(data)={background=m3_thresh_bg_fmt.};
    var measure_4 / style(data)={background=m4_thresh_bg_fmt.};
    var measure_5 / style(data)={background=m5_thresh_bg_fmt.};
    var measure_6 / style(data)={background=m6_thresh_bg_fmt.};
run;

【讨论】:

    猜你喜欢
    • 2015-01-02
    • 1970-01-01
    • 1970-01-01
    • 2014-10-28
    • 1970-01-01
    • 1970-01-01
    • 2013-05-02
    • 2020-10-11
    • 1970-01-01
    相关资源
    最近更新 更多