Each data set has 2 columns I need to plot on x and y axes in a text file (tab delimited), then each data set is separated by a blank line. I include an imaged example of the format of data to be plotted (with 3 datasets to be plotted in this example) image here.
Asked
Active
Viewed 41 times
0
-
what did you try? what worked or did not work? – pygri Mar 01 '22 at 16:04
-
I have very limited skill with coding and have only plotted 2 columns before, I don't really know where to start. I guess I need to read each dataset in as a separate array, which I would then have the skills to plot so this is a question of how to read the data in more than anything – Alex Mar 01 '22 at 16:09
-
try to read the answers here then: https://stackoverflow.com/questions/14676265/how-to-read-a-text-file-into-a-list-or-an-array-with-python – pygri Mar 01 '22 at 16:13
-
So reading there seems to give me a way to read the whole text file into a single array, but I don't know how I'd then go about reading each dataset from the file into separate arrays i.e how do I tell python to see the blank line as a start of a new dataset and to start adding to a new array from here? – Alex Mar 01 '22 at 16:23
-
My suggestion would be to do a proper tutorial on python, or even better read an introduction to programming with python book. It may take a few days to go through it, but it will help a lot to solve this and many other similar entry level programming exercises. – pygri Mar 01 '22 at 16:30
-
Please provide enough code so others can better understand or reproduce the problem. – Community Mar 01 '22 at 20:19