I need to import and data from a .dat file formatted as such:
where the first column is the x coordinate and the second and third columns are y-coordinates for two different lines. How can I import the data and format it in a way that it’s easily graphable? There is too much data to input by hand. Thank you!
One way to achieve what you want would be as follows.
Assuming the data has already been imported in to the notebook as per…
data = {{1, 1, 1}, {2, 4, 8}, {3, 9, 27}, {4, 16, 64}, {5, 25, 125}, {6, 36, 216}, {7, 49, 343}, {8, 64, 512}, {9, 81, 729}, {10, 100, 1000}};
Use the ListPlot function as shown below…
ListPlot[ data[[All, {1, #}]] & /@ {2, 3} , Joined -> True , PlotMarkers -> Automatic ]
This generates the 2D x-y graph…
A notebook implementation is attached together with the example data file (CSV format).
Hope this helps,
Ian
Import__AMP__Plot.nb (8.58 KB) test.csv (92 Bytes)
Thank you! This is perfect.