2
$\begingroup$

I have this data set in .csv and I imported them to mathematica to analyze them using Import function. Now here I have only shown a part of the dataset just to give an example of how it looks in Excel.

enter image description here

Basically there is DrainI(i), DrainV(i), GateI(i), GateV(i) where GateV(i) is constant for $i=1,2,3,4...$.

Now I want to export this into Mathematica notebook and essentially plot DrainI(i) v/s DrainV(i) for different GateV(i) in the same plot. Is there an efficient way to do this without having to store all data into different lists. Tools like Origin or IgorPlot are best suited for such plots but I also want to do some data manipulation such as finding the slope near $DrainV=0$ (as mentioned below), hence I want to do everything in Mathematica.

So I imported the data in a dataset in Mathematica using:


ds = Import["ExampleData.csv","Dataset", HeaderLines -> 1];

How do I now plot DrainI(i) v/s DrainV(i) for different GateV(i) in the same plot? Is there an efficient way to do it?

The original dataset ExampleData.csv is given below:

DrainI(1),DrainV(1),GateI(1),GateV(1),DrainI(2),DrainV(2),GateI(2),GateV(2),DrainI(3),DrainV(3),GateI(3),GateV(3),DrainI(4),DrainV(4),GateI(4),GateV(4),DrainI(5),DrainV(5),GateI(5),GateV(5)
3.29E-07,0.00E+00,1.52E-07,1.00E+00,2.97E-07,0.00E+00,1.57E-07,9.00E-01,2.57E-07,0.00E+00,1.83E-07,8.00E-01,2.19E-07,0.00E+00,1.62E-07,7.00E-01,1.83E-07,0.00E+00,1.42E-07,6.00E-01
4.33E-06,1.00E-02,1.93E-07,1.00E+00,4.24E-06,1.00E-02,1.77E-07,9.00E-01,4.14E-06,1.00E-02,1.72E-07,8.00E-01,4.01E-06,1.00E-02,1.88E-07,7.00E-01,3.87E-06,1.00E-02,1.52E-07,6.00E-01
1.27E-05,2.00E-02,1.47E-07,1.00E+00,1.22E-05,2.00E-02,1.22E-07,9.00E-01,1.17E-05,2.00E-02,1.52E-07,8.00E-01,1.11E-05,2.00E-02,1.88E-07,7.00E-01,1.05E-05,2.00E-02,2.18E-07,6.00E-01
1.91E-05,3.00E-02,1.42E-07,1.00E+00,1.83E-05,3.00E-02,1.62E-07,9.00E-01,1.75E-05,3.00E-02,1.62E-07,8.00E-01,1.66E-05,3.00E-02,1.47E-07,7.00E-01,1.56E-05,3.00E-02,1.62E-07,6.00E-01
2.55E-05,4.00E-02,1.32E-07,1.00E+00,2.44E-05,4.00E-02,8.11E-08,9.00E-01,2.33E-05,4.00E-02,2.38E-07,8.00E-01,2.21E-05,4.00E-02,1.62E-07,7.00E-01,2.08E-05,4.00E-02,1.27E-07,6.00E-01
3.18E-05,5.00E-02,1.01E-07,1.00E+00,3.05E-05,5.00E-02,1.27E-07,9.00E-01,2.91E-05,5.00E-02,1.52E-07,8.00E-01,2.76E-05,5.00E-02,1.22E-07,7.00E-01,2.60E-05,5.00E-02,1.98E-07,6.00E-01
3.81E-05,6.00E-02,1.01E-07,1.00E+00,3.66E-05,6.00E-02,1.17E-07,9.00E-01,3.49E-05,6.00E-02,1.62E-07,8.00E-01,3.31E-05,6.00E-02,1.52E-07,7.00E-01,3.11E-05,6.00E-02,1.52E-07,6.00E-01
4.45E-05,7.00E-02,6.08E-08,1.00E+00,4.26E-05,7.00E-02,1.72E-07,9.00E-01,4.07E-05,7.00E-02,1.62E-07,8.00E-01,3.85E-05,7.00E-02,1.06E-07,7.00E-01,3.62E-05,7.00E-02,1.17E-07,6.00E-01
5.07E-05,8.00E-02,1.52E-07,1.00E+00,4.86E-05,8.00E-02,1.17E-07,9.00E-01,4.64E-05,8.00E-02,1.52E-07,8.00E-01,4.39E-05,8.00E-02,1.98E-07,7.00E-01,4.13E-05,8.00E-02,1.57E-07,6.00E-01
5.71E-05,9.00E-02,1.62E-07,1.00E+00,5.47E-05,9.00E-02,1.22E-07,9.00E-01,5.21E-05,9.00E-02,1.62E-07,8.00E-01,4.94E-05,9.00E-02,1.88E-07,7.00E-01,4.63E-05,9.00E-02,1.67E-07,6.00E-01
6.34E-05,1.00E-01,7.61E-08,1.00E+00,6.07E-05,1.00E-01,1.72E-07,9.00E-01,5.79E-05,1.00E-01,1.93E-07,8.00E-01,5.47E-05,1.00E-01,2.03E-07,7.00E-01,5.14E-05,1.00E-01,1.62E-07,6.00E-01
6.97E-05,1.10E-01,1.57E-07,1.00E+00,6.68E-05,1.10E-01,1.47E-07,9.00E-01,6.36E-05,1.10E-01,1.42E-07,8.00E-01,6.01E-05,1.10E-01,2.43E-07,7.00E-01,5.65E-05,1.10E-01,1.27E-07,6.00E-01
7.60E-05,1.20E-01,1.27E-07,1.00E+00,7.29E-05,1.20E-01,1.47E-07,9.00E-01,6.93E-05,1.20E-01,1.37E-07,8.00E-01,6.56E-05,1.20E-01,1.77E-07,7.00E-01,6.15E-05,1.20E-01,1.32E-07,6.00E-01
8.24E-05,1.30E-01,1.06E-07,1.00E+00,7.88E-05,1.30E-01,1.32E-07,9.00E-01,7.51E-05,1.30E-01,1.47E-07,8.00E-01,7.09E-05,1.30E-01,1.83E-07,7.00E-01,6.64E-05,1.30E-01,1.57E-07,6.00E-01
8.86E-05,1.40E-01,1.12E-07,1.00E+00,8.48E-05,1.40E-01,1.42E-07,9.00E-01,8.07E-05,1.40E-01,1.42E-07,8.00E-01,7.62E-05,1.40E-01,1.67E-07,7.00E-01,7.15E-05,1.40E-01,1.12E-07,6.00E-01
9.50E-05,1.50E-01,1.06E-07,1.00E+00,9.09E-05,1.50E-01,1.83E-07,9.00E-01,8.64E-05,1.50E-01,1.62E-07,8.00E-01,8.16E-05,1.50E-01,2.38E-07,7.00E-01,7.64E-05,1.50E-01,1.47E-07,6.00E-01
1.01E-04,1.60E-01,1.01E-07,1.00E+00,9.68E-05,1.60E-01,1.93E-07,9.00E-01,9.21E-05,1.60E-01,2.18E-07,8.00E-01,8.69E-05,1.60E-01,1.06E-07,7.00E-01,8.13E-05,1.60E-01,1.32E-07,6.00E-01
1.08E-04,1.70E-01,8.62E-08,1.00E+00,1.03E-04,1.70E-01,1.32E-07,9.00E-01,9.78E-05,1.70E-01,1.32E-07,8.00E-01,9.22E-05,1.70E-01,1.67E-07,7.00E-01,8.64E-05,1.70E-01,1.88E-07,6.00E-01
1.14E-04,1.80E-01,6.08E-08,1.00E+00,1.09E-04,1.80E-01,1.42E-07,9.00E-01,1.03E-04,1.80E-01,1.72E-07,8.00E-01,9.76E-05,1.80E-01,1.83E-07,7.00E-01,9.13E-05,1.80E-01,1.93E-07,6.00E-01
1.20E-04,1.90E-01,1.22E-07,1.00E+00,1.15E-04,1.90E-01,1.22E-07,9.00E-01,1.09E-04,1.90E-01,1.57E-07,8.00E-01,1.03E-04,1.90E-01,2.33E-07,7.00E-01,9.61E-05,1.90E-01,1.57E-07,6.00E-01
1.27E-04,2.00E-01,1.32E-07,1.00E+00,1.21E-04,2.00E-01,1.32E-07,9.00E-01,1.15E-04,2.00E-01,1.12E-07,8.00E-01,1.08E-04,2.00E-01,2.43E-07,7.00E-01,1.01E-04,2.00E-01,1.47E-07,6.00E-01
1.33E-04,2.10E-01,1.77E-07,1.00E+00,1.27E-04,2.10E-01,1.32E-07,9.00E-01,1.20E-04,2.10E-01,1.32E-07,8.00E-01,1.13E-04,2.10E-01,1.57E-07,7.00E-01,1.06E-04,2.10E-01,1.83E-07,6.00E-01
1.39E-04,2.20E-01,1.42E-07,1.00E+00,1.33E-04,2.20E-01,1.37E-07,9.00E-01,1.26E-04,2.20E-01,1.88E-07,8.00E-01,1.19E-04,2.20E-01,1.88E-07,7.00E-01,1.11E-04,2.20E-01,1.52E-07,6.00E-01
1.45E-04,2.30E-01,1.32E-07,1.00E+00,1.39E-04,2.30E-01,1.88E-07,9.00E-01,1.32E-04,2.30E-01,1.62E-07,8.00E-01,1.24E-04,2.30E-01,1.52E-07,7.00E-01,1.16E-04,2.30E-01,1.57E-07,6.00E-01
1.52E-04,2.40E-01,1.22E-07,1.00E+00,1.45E-04,2.40E-01,1.88E-07,9.00E-01,1.37E-04,2.40E-01,1.77E-07,8.00E-01,1.29E-04,2.40E-01,1.32E-07,7.00E-01,1.20E-04,2.40E-01,1.42E-07,6.00E-01
1.58E-04,2.50E-01,8.62E-08,1.00E+00,1.51E-04,2.50E-01,2.03E-07,9.00E-01,1.43E-04,2.50E-01,1.47E-07,8.00E-01,1.34E-04,2.50E-01,1.62E-07,7.00E-01,1.25E-04,2.50E-01,1.27E-07,6.00E-01
1.64E-04,2.60E-01,1.12E-07,1.00E+00,1.57E-04,2.60E-01,1.77E-07,9.00E-01,1.49E-04,2.60E-01,1.47E-07,8.00E-01,1.39E-04,2.60E-01,1.72E-07,7.00E-01,1.30E-04,2.60E-01,1.12E-07,6.00E-01
1.71E-04,2.70E-01,9.13E-08,1.00E+00,1.63E-04,2.70E-01,1.52E-07,9.00E-01,1.54E-04,2.70E-01,1.57E-07,8.00E-01,1.45E-04,2.70E-01,1.12E-07,7.00E-01,1.35E-04,2.70E-01,1.67E-07,6.00E-01
1.77E-04,2.80E-01,1.01E-07,1.00E+00,1.69E-04,2.80E-01,1.42E-07,9.00E-01,1.60E-04,2.80E-01,1.52E-07,8.00E-01,1.50E-04,2.80E-01,1.06E-07,7.00E-01,1.39E-04,2.80E-01,1.52E-07,6.00E-01
1.83E-04,2.90E-01,1.17E-07,1.00E+00,1.75E-04,2.90E-01,1.12E-07,9.00E-01,1.65E-04,2.90E-01,1.37E-07,8.00E-01,1.55E-04,2.90E-01,9.63E-08,7.00E-01,1.44E-04,2.90E-01,1.77E-07,6.00E-01
1.90E-04,3.00E-01,6.59E-08,1.00E+00,1.81E-04,3.00E-01,1.57E-07,9.00E-01,1.71E-04,3.00E-01,1.72E-07,8.00E-01,1.60E-04,3.00E-01,1.17E-07,7.00E-01,1.49E-04,3.00E-01,1.57E-07,6.00E-01
1.96E-04,3.10E-01,6.08E-08,1.00E+00,1.87E-04,3.10E-01,1.32E-07,9.00E-01,1.76E-04,3.10E-01,1.27E-07,8.00E-01,1.65E-04,3.10E-01,1.06E-07,7.00E-01,1.54E-04,3.10E-01,1.22E-07,6.00E-01
2.02E-04,3.20E-01,1.01E-07,1.00E+00,1.92E-04,3.20E-01,1.12E-07,9.00E-01,1.82E-04,3.20E-01,1.06E-07,8.00E-01,1.70E-04,3.20E-01,8.11E-08,7.00E-01,1.58E-04,3.20E-01,1.37E-07,6.00E-01
2.09E-04,3.30E-01,1.01E-07,1.00E+00,1.99E-04,3.30E-01,1.22E-07,9.00E-01,1.87E-04,3.30E-01,1.27E-07,8.00E-01,1.75E-04,3.30E-01,1.12E-07,7.00E-01,1.63E-04,3.30E-01,1.47E-07,6.00E-01
2.15E-04,3.40E-01,1.22E-07,1.00E+00,2.04E-04,3.40E-01,2.18E-07,9.00E-01,1.93E-04,3.40E-01,9.63E-08,8.00E-01,1.81E-04,3.40E-01,1.52E-07,7.00E-01,1.67E-04,3.40E-01,1.67E-07,6.00E-01
2.21E-04,3.50E-01,9.63E-08,1.00E+00,2.10E-04,3.50E-01,1.77E-07,9.00E-01,1.99E-04,3.50E-01,1.32E-07,8.00E-01,1.85E-04,3.50E-01,1.27E-07,7.00E-01,1.72E-04,3.50E-01,1.77E-07,6.00E-01
2.27E-04,3.60E-01,1.17E-07,1.00E+00,2.16E-04,3.60E-01,1.47E-07,9.00E-01,2.04E-04,3.60E-01,1.77E-07,8.00E-01,1.90E-04,3.60E-01,1.57E-07,7.00E-01,1.77E-04,3.60E-01,1.52E-07,6.00E-01
2.34E-04,3.70E-01,1.06E-07,1.00E+00,2.22E-04,3.70E-01,2.48E-07,9.00E-01,2.09E-04,3.70E-01,1.88E-07,8.00E-01,1.96E-04,3.70E-01,1.42E-07,7.00E-01,1.81E-04,3.70E-01,2.08E-07,6.00E-01
2.40E-04,3.80E-01,9.63E-08,1.00E+00,2.28E-04,3.80E-01,1.32E-07,9.00E-01,2.15E-04,3.80E-01,1.22E-07,8.00E-01,2.01E-04,3.80E-01,9.63E-08,7.00E-01,1.86E-04,3.80E-01,1.77E-07,6.00E-01

$\endgroup$

2 Answers 2

2
$\begingroup$

Try this:

data = ImportString[
  "DrainI(1),DrainV(1),GateI(1),GateV(1),DrainI(2),DrainV(2),GateI(2),\
GateV(2),DrainI(3),DrainV(3),GateI(3),GateV(3),DrainI(4),DrainV(4),\
GateI(4),GateV(4),DrainI(5),DrainV(5),GateI(5),GateV(5)
  3.29E-07,0.00E+00,1.52E-07,1.00E+00,2.97E-07,0.00E+00,1.57E-07,9.\
00E-01,2.57E-07,0.00E+00,1.83E-07,8.00E-01,2.19E-07,0.00E+00,1.62E-07,\
7.00E-01,1.83E-07,0.00E+00,1.42E-07,6.00E-01
  4.33E-06,1.00E-02,1.93E-07,1.00E+00,4.24E-06,1.00E-02,1.77E-07,9.\
00E-01,4.14E-06,1.00E-02,1.72E-07,8.00E-01,4.01E-06,1.00E-02,1.88E-07,\
7.00E-01,3.87E-06,1.00E-02,1.52E-07,6.00E-01
  1.27E-05,2.00E-02,1.47E-07,1.00E+00,1.22E-05,2.00E-02,1.22E-07,9.\
00E-01,1.17E-05,2.00E-02,1.52E-07,8.00E-01,1.11E-05,2.00E-02,1.88E-07,\
7.00E-01,1.05E-05,2.00E-02,2.18E-07,6.00E-01
  1.91E-05,3.00E-02,1.42E-07,1.00E+00,1.83E-05,3.00E-02,1.62E-07,9.\
00E-01,1.75E-05,3.00E-02,1.62E-07,8.00E-01,1.66E-05,3.00E-02,1.47E-07,\
7.00E-01,1.56E-05,3.00E-02,1.62E-07,6.00E-01
  2.55E-05,4.00E-02,1.32E-07,1.00E+00,2.44E-05,4.00E-02,8.11E-08,9.\
00E-01,2.33E-05,4.00E-02,2.38E-07,8.00E-01,2.21E-05,4.00E-02,1.62E-07,\
7.00E-01,2.08E-05,4.00E-02,1.27E-07,6.00E-01
  3.18E-05,5.00E-02,1.01E-07,1.00E+00,3.05E-05,5.00E-02,1.27E-07,9.\
00E-01,2.91E-05,5.00E-02,1.52E-07,8.00E-01,2.76E-05,5.00E-02,1.22E-07,\
7.00E-01,2.60E-05,5.00E-02,1.98E-07,6.00E-01
  3.81E-05,6.00E-02,1.01E-07,1.00E+00,3.66E-05,6.00E-02,1.17E-07,9.\
00E-01,3.49E-05,6.00E-02,1.62E-07,8.00E-01,3.31E-05,6.00E-02,1.52E-07,\
7.00E-01,3.11E-05,6.00E-02,1.52E-07,6.00E-01
  4.45E-05,7.00E-02,6.08E-08,1.00E+00,4.26E-05,7.00E-02,1.72E-07,9.\
00E-01,4.07E-05,7.00E-02,1.62E-07,8.00E-01,3.85E-05,7.00E-02,1.06E-07,\
7.00E-01,3.62E-05,7.00E-02,1.17E-07,6.00E-01
  5.07E-05,8.00E-02,1.52E-07,1.00E+00,4.86E-05,8.00E-02,1.17E-07,9.\
00E-01,4.64E-05,8.00E-02,1.52E-07,8.00E-01,4.39E-05,8.00E-02,1.98E-07,\
7.00E-01,4.13E-05,8.00E-02,1.57E-07,6.00E-01
  5.71E-05,9.00E-02,1.62E-07,1.00E+00,5.47E-05,9.00E-02,1.22E-07,9.\
00E-01,5.21E-05,9.00E-02,1.62E-07,8.00E-01,4.94E-05,9.00E-02,1.88E-07,\
7.00E-01,4.63E-05,9.00E-02,1.67E-07,6.00E-01
  6.34E-05,1.00E-01,7.61E-08,1.00E+00,6.07E-05,1.00E-01,1.72E-07,9.\
00E-01,5.79E-05,1.00E-01,1.93E-07,8.00E-01,5.47E-05,1.00E-01,2.03E-07,\
7.00E-01,5.14E-05,1.00E-01,1.62E-07,6.00E-01
  6.97E-05,1.10E-01,1.57E-07,1.00E+00,6.68E-05,1.10E-01,1.47E-07,9.\
00E-01,6.36E-05,1.10E-01,1.42E-07,8.00E-01,6.01E-05,1.10E-01,2.43E-07,\
7.00E-01,5.65E-05,1.10E-01,1.27E-07,6.00E-01
  7.60E-05,1.20E-01,1.27E-07,1.00E+00,7.29E-05,1.20E-01,1.47E-07,9.\
00E-01,6.93E-05,1.20E-01,1.37E-07,8.00E-01,6.56E-05,1.20E-01,1.77E-07,\
7.00E-01,6.15E-05,1.20E-01,1.32E-07,6.00E-01
  8.24E-05,1.30E-01,1.06E-07,1.00E+00,7.88E-05,1.30E-01,1.32E-07,9.\
00E-01,7.51E-05,1.30E-01,1.47E-07,8.00E-01,7.09E-05,1.30E-01,1.83E-07,\
7.00E-01,6.64E-05,1.30E-01,1.57E-07,6.00E-01
  8.86E-05,1.40E-01,1.12E-07,1.00E+00,8.48E-05,1.40E-01,1.42E-07,9.\
00E-01,8.07E-05,1.40E-01,1.42E-07,8.00E-01,7.62E-05,1.40E-01,1.67E-07,\
7.00E-01,7.15E-05,1.40E-01,1.12E-07,6.00E-01
  9.50E-05,1.50E-01,1.06E-07,1.00E+00,9.09E-05,1.50E-01,1.83E-07,9.\
00E-01,8.64E-05,1.50E-01,1.62E-07,8.00E-01,8.16E-05,1.50E-01,2.38E-07,\
7.00E-01,7.64E-05,1.50E-01,1.47E-07,6.00E-01
  1.01E-04,1.60E-01,1.01E-07,1.00E+00,9.68E-05,1.60E-01,1.93E-07,9.\
00E-01,9.21E-05,1.60E-01,2.18E-07,8.00E-01,8.69E-05,1.60E-01,1.06E-07,\
7.00E-01,8.13E-05,1.60E-01,1.32E-07,6.00E-01
  1.08E-04,1.70E-01,8.62E-08,1.00E+00,1.03E-04,1.70E-01,1.32E-07,9.\
00E-01,9.78E-05,1.70E-01,1.32E-07,8.00E-01,9.22E-05,1.70E-01,1.67E-07,\
7.00E-01,8.64E-05,1.70E-01,1.88E-07,6.00E-01
  1.14E-04,1.80E-01,6.08E-08,1.00E+00,1.09E-04,1.80E-01,1.42E-07,9.\
00E-01,1.03E-04,1.80E-01,1.72E-07,8.00E-01,9.76E-05,1.80E-01,1.83E-07,\
7.00E-01,9.13E-05,1.80E-01,1.93E-07,6.00E-01
  1.20E-04,1.90E-01,1.22E-07,1.00E+00,1.15E-04,1.90E-01,1.22E-07,9.\
00E-01,1.09E-04,1.90E-01,1.57E-07,8.00E-01,1.03E-04,1.90E-01,2.33E-07,\
7.00E-01,9.61E-05,1.90E-01,1.57E-07,6.00E-01
  1.27E-04,2.00E-01,1.32E-07,1.00E+00,1.21E-04,2.00E-01,1.32E-07,9.\
00E-01,1.15E-04,2.00E-01,1.12E-07,8.00E-01,1.08E-04,2.00E-01,2.43E-07,\
7.00E-01,1.01E-04,2.00E-01,1.47E-07,6.00E-01
  1.33E-04,2.10E-01,1.77E-07,1.00E+00,1.27E-04,2.10E-01,1.32E-07,9.\
00E-01,1.20E-04,2.10E-01,1.32E-07,8.00E-01,1.13E-04,2.10E-01,1.57E-07,\
7.00E-01,1.06E-04,2.10E-01,1.83E-07,6.00E-01
  1.39E-04,2.20E-01,1.42E-07,1.00E+00,1.33E-04,2.20E-01,1.37E-07,9.\
00E-01,1.26E-04,2.20E-01,1.88E-07,8.00E-01,1.19E-04,2.20E-01,1.88E-07,\
7.00E-01,1.11E-04,2.20E-01,1.52E-07,6.00E-01
  1.45E-04,2.30E-01,1.32E-07,1.00E+00,1.39E-04,2.30E-01,1.88E-07,9.\
00E-01,1.32E-04,2.30E-01,1.62E-07,8.00E-01,1.24E-04,2.30E-01,1.52E-07,\
7.00E-01,1.16E-04,2.30E-01,1.57E-07,6.00E-01
  1.52E-04,2.40E-01,1.22E-07,1.00E+00,1.45E-04,2.40E-01,1.88E-07,9.\
00E-01,1.37E-04,2.40E-01,1.77E-07,8.00E-01,1.29E-04,2.40E-01,1.32E-07,\
7.00E-01,1.20E-04,2.40E-01,1.42E-07,6.00E-01
  1.58E-04,2.50E-01,8.62E-08,1.00E+00,1.51E-04,2.50E-01,2.03E-07,9.\
00E-01,1.43E-04,2.50E-01,1.47E-07,8.00E-01,1.34E-04,2.50E-01,1.62E-07,\
7.00E-01,1.25E-04,2.50E-01,1.27E-07,6.00E-01
  1.64E-04,2.60E-01,1.12E-07,1.00E+00,1.57E-04,2.60E-01,1.77E-07,9.\
00E-01,1.49E-04,2.60E-01,1.47E-07,8.00E-01,1.39E-04,2.60E-01,1.72E-07,\
7.00E-01,1.30E-04,2.60E-01,1.12E-07,6.00E-01
  1.71E-04,2.70E-01,9.13E-08,1.00E+00,1.63E-04,2.70E-01,1.52E-07,9.\
00E-01,1.54E-04,2.70E-01,1.57E-07,8.00E-01,1.45E-04,2.70E-01,1.12E-07,\
7.00E-01,1.35E-04,2.70E-01,1.67E-07,6.00E-01
  1.77E-04,2.80E-01,1.01E-07,1.00E+00,1.69E-04,2.80E-01,1.42E-07,9.\
00E-01,1.60E-04,2.80E-01,1.52E-07,8.00E-01,1.50E-04,2.80E-01,1.06E-07,\
7.00E-01,1.39E-04,2.80E-01,1.52E-07,6.00E-01
  1.83E-04,2.90E-01,1.17E-07,1.00E+00,1.75E-04,2.90E-01,1.12E-07,9.\
00E-01,1.65E-04,2.90E-01,1.37E-07,8.00E-01,1.55E-04,2.90E-01,9.63E-08,\
7.00E-01,1.44E-04,2.90E-01,1.77E-07,6.00E-01
  1.90E-04,3.00E-01,6.59E-08,1.00E+00,1.81E-04,3.00E-01,1.57E-07,9.\
00E-01,1.71E-04,3.00E-01,1.72E-07,8.00E-01,1.60E-04,3.00E-01,1.17E-07,\
7.00E-01,1.49E-04,3.00E-01,1.57E-07,6.00E-01
  1.96E-04,3.10E-01,6.08E-08,1.00E+00,1.87E-04,3.10E-01,1.32E-07,9.\
00E-01,1.76E-04,3.10E-01,1.27E-07,8.00E-01,1.65E-04,3.10E-01,1.06E-07,\
7.00E-01,1.54E-04,3.10E-01,1.22E-07,6.00E-01
  2.02E-04,3.20E-01,1.01E-07,1.00E+00,1.92E-04,3.20E-01,1.12E-07,9.\
00E-01,1.82E-04,3.20E-01,1.06E-07,8.00E-01,1.70E-04,3.20E-01,8.11E-08,\
7.00E-01,1.58E-04,3.20E-01,1.37E-07,6.00E-01
  2.09E-04,3.30E-01,1.01E-07,1.00E+00,1.99E-04,3.30E-01,1.22E-07,9.\
00E-01,1.87E-04,3.30E-01,1.27E-07,8.00E-01,1.75E-04,3.30E-01,1.12E-07,\
7.00E-01,1.63E-04,3.30E-01,1.47E-07,6.00E-01
  2.15E-04,3.40E-01,1.22E-07,1.00E+00,2.04E-04,3.40E-01,2.18E-07,9.\
00E-01,1.93E-04,3.40E-01,9.63E-08,8.00E-01,1.81E-04,3.40E-01,1.52E-07,\
7.00E-01,1.67E-04,3.40E-01,1.67E-07,6.00E-01
  2.21E-04,3.50E-01,9.63E-08,1.00E+00,2.10E-04,3.50E-01,1.77E-07,9.\
00E-01,1.99E-04,3.50E-01,1.32E-07,8.00E-01,1.85E-04,3.50E-01,1.27E-07,\
7.00E-01,1.72E-04,3.50E-01,1.77E-07,6.00E-01
  2.27E-04,3.60E-01,1.17E-07,1.00E+00,2.16E-04,3.60E-01,1.47E-07,9.\
00E-01,2.04E-04,3.60E-01,1.77E-07,8.00E-01,1.90E-04,3.60E-01,1.57E-07,\
7.00E-01,1.77E-04,3.60E-01,1.52E-07,6.00E-01
  2.34E-04,3.70E-01,1.06E-07,1.00E+00,2.22E-04,3.70E-01,2.48E-07,9.\
00E-01,2.09E-04,3.70E-01,1.88E-07,8.00E-01,1.96E-04,3.70E-01,1.42E-07,\
7.00E-01,1.81E-04,3.70E-01,2.08E-07,6.00E-01
  2.40E-04,3.80E-01,9.63E-08,1.00E+00,2.28E-04,3.80E-01,1.32E-07,9.\
00E-01,2.15E-04,3.80E-01,1.22E-07,8.00E-01,2.01E-04,3.80E-01,9.63E-08,\
7.00E-01,1.86E-04,3.80E-01,1.77E-07,6.00E-01
  ", "CSV", HeaderLines -> 1];

Then:

extracted = data // Transpose // Partition[#, 4] & // Map[Transpose];
ListLinePlot[
   extracted[[All, All, ;; 2]], 
   PlotLegends -> DeleteDuplicates@Flatten@extracted[[All, All, 4]]
]

enter image description here

$\endgroup$
2
  • $\begingroup$ Thanks I am still trying to understand what you did here but if I had to manipulate each datalist independently, let's say divide all DrainI(i) by 5 and then plot. And then I want to fit each DrainI(i) v/s DrainV(i) with a function, let's say a linear function and extract the slope, is there an easy way to do it? $\endgroup$ Feb 8, 2021 at 4:18
  • $\begingroup$ There’s definitely ways to do it. That’s a different question though. Consider that extracted[[All, All, ;;2]] is a list of datasets. You can Map a function over this to apply it to each dataset, for instance LinearModelFit[#, a x + b, {a, b}, x]& to get lines fitted. $\endgroup$
    – MarcoB
    Feb 9, 2021 at 13:33
2
$\begingroup$

Here is another way to do it while trying to remain in the dataset framework. First, we will import the string text representing the CSV file and then convert it into a dataset:

(*Import text from pastebin for conciseness*)
txt = Import["https://pastebin.com/raw/brLjwh8C", "Text"];
(*Convert to dataset*)
ds = SemanticImportString[txt]

Initial data set

Following the approach from my answer to this question 239689, we can create a legended plot of the desired pairs:

(*Get column headers grouped by index*)
nds = Partition[Normal[Keys[First[ds]]], 4];
(*Get plotting pairs*)
xypairs = nds[[All, {1, 2}]];
(*Use dataset to create ListLinePlot of xypairs*)
plt = ds[Transpose /* Values /* ListLinePlot, xypairs];
(*Add a legend to plot*)
(*Use standard color list 97*)
colors = ColorData[97, "ColorList"][[;; Length@xypairs]];
labels = Style[StringTemplate["`2` vs `1`"][##], 14] & @@@ xypairs;
legend = LineLegend[Directive[#, AbsoluteThickness[2]] & /@ colors, 
   labels];
Legended[plt, Placed[legend, Automatic]]

Multi-plot

One could probably make better use of the data if it were structured in a stacked format. This would allow one to make use of pivot tables in Excel or other statistical packages such as JMP.

The following workflow will create a stacked dataset with a common stacked header:

(*Import text as CSV*)
ls = ImportString[txt, "CSV"];
(*Create stacked header names*)
stackedheaders = (First@StringSplit[#, "("] & /@ First@Take[ls, 1, 4]);
(*Convert to a stacked dataset*)
dsstacked = 
 SemanticImportString@
  ExportString[
   Prepend[ArrayReshape[Flatten@Rest@ls, {(Length@ls - 1) 5, 4}], 
    stackedheaders], "CSV"]

Stacked data set

Now, you can perform some interesting operations using GroupBy. For example, we can generate a series of ListPlots grouped by GateV:

dsstacked[GroupBy["GateV"], 
 ListLinePlot[Transpose@#, ImageSize -> Large] &, {{"DrainV", 
   "DrainI"}}]

Grouped by list plots

More interestingly, we can create parabolic fits using GroupBy:

dsstacked[GroupBy["GateV"], 
 Normal@LinearModelFit[Flatten[Values[#], 1], {x^2, x}, 
    x] &, {{"DrainV", "DrainI"}}]

Parabolic fits

Finally, it is straightforward to extract the initial slopes using the following:

dsstacked[GroupBy["GateV"], 
 D[Normal@LinearModelFit[Flatten[Values[#], 1], {x^2, x}, x], x] /. 
   x -> 0 &, {{"DrainV", "DrainI"}}]

Slope extraction

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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