If your dataset named test.dat with space delimited has the following contents (Iris dataset).
1 5.1 3.5 1.4 0.2 setosa
2 4.9 3.0 1.4 0.2 setosa
3 4.7 3.2 1.3 0.2 setosa
4 4.6 3.1 1.5 0.2 setosa
5 5.0 3.6 1.4 0.2 setosa
6 5.4 3.9 1.7 0.4 setosa
7 4.6 3.4 1.4 0.3 setosa
8 5.0 3.4 1.5 0.2 setosa
9 4.4 2.9 1.4 0.2 setosa
10 4.9 3.1 1.5 0.1 setosa
You can read this into Mathematica with only one command:
mydata = ReadList["~/iris.txt", {Number, Real, Real, Real, Real, String}] ;
Show the dataset
mydata // TableForm
Read the 2-3 column from the dataset.
iris1 = mydata[[1, Table[i, {i, 1, 50}], {2, 3}]]; iris2 = mydata[[1, Table[i, {i, 51, 100}], {2, 3}]]; iris3 = mydata[[1, Table[i, {i, 101, 150}], {2, 3}]];
Plot the Scatter Plot
Step 1.
Needs["Graphics`MultipleListPlot`"];
Step 2.
讀者回應 ( 0 意見 )
訂閱發佈留言 (Atom)
發佈留言
Please leave your name and tell me what you thought about this site. Comments, suggestions and views are welcomed.
如果這篇文章對你有幫助,那請留個訊息給我~