I have a data file containing 6 columns and I am going to read it using genfromtxt and store the data in such a way that the first and second column go to variables mCH, tb and the rest (columns 2 to 5) go to BR so that I can plot different BR columns like this:
mCH, tb, BR = np.genfromtxt(BRfile, unpack=True)
for i in range(4):
CS = axs[i].tricontour(mCH, tb, BR[i], cmap='gnuplot')
...
The BRfile has the following structure:
150 1 0.2 0.3 0.4 0.1
150 2 0.25 0.25 0.4 0.1
160 1 0.2 0.3 0.45 0.05
160 2 0.25 0.25 0.45 0.05
But when I run the code, it can not realize that BR is going to be used for 4 columns and gives this error:
ValueError: too many values to unpack (expected 3)
Would be grateful if any help. Thanks, Majid
Thanks, I actually got it working in the following style:
data = np.genfromtxt(BRfile,unpack=True)
mCH, tb = data[:2]
BR = data[2:]