绘制d维数据

时间:2012-04-25 12:19:24

标签: java r matlab plot octave

我在.txt文件中有以下数据格式。

नोभेम्बर 
 [0.013597779962868256, -0.10849757437254635, -0.15999846585159766, -1.2417475384869558, -0.6802765400695919, 0.44552601044477186, 0.10820787964125786, -1.584483680411645, 0.2007759414522207, -0.7101547556233192]
 बाट
[0.7488351202673913, 0.3645634610332536, 0.1937027124201285, -0.10361011958447905, 0.48222626651261347, 0.36795608937720814, -0.06307932558713457, -0.05626217864435294, -0.5245206209054951, 0.40256760017279525]
रूपमा
[0.06077674960453302, 0.2570556052636379, 0.3347552495487344, -0.10512580657948888, 0.10414134700640766, 0.19736087970834254, 0.09207914995816116, 0.19904934221006, 0.061402311347008, -0.11409541813280075]
बोर्डमा
[0.5200111891848155, -0.14947230042320633, 0.7351562111464331, -0.7542450932215059, 1.4477558941048831, -0.6235133303135835, -0.7781689512584442, -0.057886889872348815, 0.10625424653444066, 0.9777761194886687]
आउनु
[1.0596966006985387, 0.24909505933749815, 0.5181999691383957, -0.01983089009044503, -1.4106664226234644, -0.020542297788816014, -0.7822719255911348, 0.42914674116391344, -0.5753257725556651, -0.9141151600890186]

单词 नोभेम्बर 是数据点,数值是它们的向量表示。我想把这些表述作为坐标并绘制它们以便找到它们之间的关系。绘制它们的可能性是什么。任何建议的工具都非常受欢迎。

2 个答案:

答案 0 :(得分:2)

我的GUI无法处理项目名称的字体,但如果我将它们命名为:a,b,cc,d,e,您可以使用平行坐标图来显示多维特征:

require(MASS)  # an R package
parcoord(data.frame(a=a,b=b,cc=cc,d=d,e=e), col=1:5)

enter image description here

答案 1 :(得分:1)

这是一个MATLAB解决方案。

首先我们读取数据。虽然MATLAB能够读取Unicode文本,但它有some issues displaying it in GUI(所以我只是用Point1 / Point2等替换标签。)

%# read file lines
fid = fopen('data.txt', 'rt', 'native', 'UTF-8');
C = textscan(fid, '%s', 'Delimiter','\n');
fclose(fid);
C = C{1};

%# split into labels/data
labels = C(1:2:end);
data = cellfun(@str2num, C(2:2:end), 'UniformOutput',false);
data = cell2mat(data);

%# HACK: MATLAB has issues displaying unicode text
labels = num2str((1:size(data,1))', 'Point %d');

接下来,我们可以使用parallel coordinates绘制数据:

%# you might need to normalize the attributes
%#data = zscore(data);

plot(data');            %'# plot lines
set(gca, 'XTick',1:numDim, 'XGrid','on')
xlabel('Features'), ylabel('Feature value')
title('Parallel Coordinates')
legend(labels)          %# show legend of labels

parallel coordinates

如果您可以访问统计工具箱,则可以visualize multivariate data使用多种技术:

%# parallel coordinates (similar the above)
parallelcoords(data, 'Group',labels)

%# glyph plot (stars)
glyphplot(data, 'obslabels',labels, 'glyph','star')

glyphplot_star

%# glyph plot (Chernoff faces)
glyphplot(data, 'obslabels',labels, 'glyph','face')

glyphplot_face

%# Andrews curves
andrewsplot(data, 'Group',labels)

andrewsplot