我有一個標籤數據集,我想根據標籤着色點。是否有一種簡單的方法來獲取當前線的內部圖形,以便我可以確定該點屬於哪個類別?根據標籤在Mathematica中着色繪圖
我明白x,y,z
是繪製數據的座標,但它對外部標籤沒有幫助。
這是非常醜陋的,它只適用於有規律分佈的排序數據集。
data = Import["http://ftp.ics.uci.edu/pub/machine-learning-databases/iris/iris.data"];
data = Drop[data, -1]; (*there one extra line at the end*)
inData = data[[All, 1 ;; 4]];
labels = data[[All, 5]];
ListPlot3D[inData,
ColorFunction ->
Function[{x, y, z},
If[y < 0.33, RGBColor[1, 1, 0.],
If[y < 0.66, RGBColor[1, 0, 0.], RGBColor[1, 0, 1]]
]
]
]
預期結果:
凡在數據集中的標籤?請描述結構 –
標籤是字符串,它可以用數字或RGB顏色代替,它並不重要 – Tombart
問題仍然不完全清楚,示例數據集會很好。你需要繪製單獨的點或表面?數據的格式是什麼?建議:你可以按照類別劃分你的積分,並且自己劃分每個類別嗎? 'GatherBy'可能會有用。 – Szabolcs