Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I have a CSV file with $9$ columns. I want to plot them in the following way. Column $1$ will be along the $X$-axis. Any point $(x_i, y_i)$ of $i$-th curve in the plot will have the $x$ value from the corresponding row of column $1$ and the $y$ value from the $x$-th row of the $(i-1)$-th column. So, there will be $8$ curves in the plot. The file could be downloaded from this link. The code is:

data = Import["iso-pair-data.csv", "CSV"]; ListPlot[{data[[All, 2]],
data[[All, 3]], data[[All, 4]]}, Joined -> True, PlotMarkers -> Automatic]

I am not getting the plot as expected. Any help?

share|improve this question
1  
I think this is what you're trying to do: ListPlot[Rest@Transpose@data, Joined -> True, PlotRange -> Full] –  Pickett Jul 16 at 20:40
1  
I do not get it. Lets say i=2, ok? So the first column is the x-values, fine. Now the y-values you are saying come from the rows of the (i-1) column? but this is 1 in this case? But that is supposed to be the x-values for all the other columns. Are you simply trying to plot columns 2-9 against the first column? –  Nasser Jul 16 at 20:40
1  
@Nasser It should be i+1... if you use all the information in the question I don't think there can be any doubt. –  Pickett Jul 16 at 20:43

1 Answer 1

up vote 4 down vote accepted

Does this work for you?

data=Import[["iso-pair-data.csv"];
vals = Table[Transpose[{data[[All, 1]], data[[All, i]]}], {i, 2, 
Length@First@data}];
ListLinePlot[vals, Joined -> True, 
 PlotRange -> {Automatic, {0, Max[data[[All, 2 ;;]]]}}, 
 ImageSize -> Large]

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.