平行坐標圖怎麼畫?

MATLAB,Excel,Python,R語言等都可以.

如圖


這裡有一個 MATLAB 簡單的例子,可以在此基礎上修改得到你想要的樣子:

load fisheriris
labels = {"Sepal Length", "Sepal Width", "Petal Length", "Petal Width"};

data = meas;
nVar = size(meas, 2);
tickLen = .05;

figure color w
nTick = randi([3 10], 1, nVar);
[low, high] = bounds(data, 1);

cmap = num2cell(lines(numel(labels)), 2);
color = cmap(double(categorical(species)));
linePlot = line(1 : nVar, (data - low) ./ (high - low));
[linePlot.Color] = color{:};

line(repmat(1 : nVar, 2, 1), repmat([0; 1], 1, nVar), "color", "k", "lineWidth", 1)

x = repelem(1 : nVar, nTick);
y = cell2mat(arrayfun(@(k) 0 : 1 / (k - 1) : 1, nTick, "un", 0));

tickX = [x; x - tickLen; nan + x];
tickY = [y; y; nan + y];
line(tickX(:), tickY(:), "color", "k", "lineWidth", 1)

tickLabel = compose("%6.2f", y .* repelem(high - low, nTick) + repelem(low, nTick));
text(x(:) - tickLen, y(:), tickLabel(:), "HorizontalAlignment", "right")

text(1 : nVar, 1.02 + zeros(1, nVar), labels, ...
"HorizontalAlignment", "center", "VerticalAlignment", "bottom")

axis tight off


使用最經典的數據集——fisher的iris數據集。三種顏色分別代表三種品種,四個縱坐標分別代表四個特徵變數。使用平行坐標圖就能將這三種品種大致區分開了。

MATLAB:

load fisheriris
labels = {"Sepal Length","Sepal Width","Petal Length","Petal Width"};
parallelcoords(meas,"Group",species,"Labels",labels)


謝邀。

我不會。


不用寫代碼,GeoDa 可以直接生成


調和曲線圖和輪廓圖的比較 | 統計之都


推薦閱讀:

excel單元格中有幾組數據,如何將其拆分為幾行?同時不影響其他相關聯的數據
麻煩有excel高手幫我解釋下sumif(B:B,B:B,A:A)具體是什麼?
Excel 函數「vlookup」可不可以 lookup 到近似值?函數該怎麼寫?
execl多個條件查找 求助查詢公式?

TAG:Python | MATLAB | MicrosoftExcel | 數據可視化 | R編程語言 |