I'd want to make a graph in which the colours of the many curves they represent change depending on a matching value in a specific column.
The database is presented as follows:
row0 = {"A":[0,1,2,3,4,5], "B":[0,2,4,6,8,10]}
row1 = {"A":[0,1,2,3,4,5], "B":[0,3,9,12,15,18]}
row2 = {"A":[0,1,2,3,4,5], "B":[0,4,8,12,16,20]}
row = [row0,row1,row2]
Test = {"Float":[0.5,10.24,25.2], "Funtions": row }
Test_ = pd.DataFrame(data = Test)
A column in the Dataframe contains float values. The second column contains a dataframe with two columns (pandas.core.frame.DataFrame).
Basically, I want to plot the graph in the second column for each row.
I can easily do this in this way:
for m in range(len(Test_)):
Func = (Test_["Funtions"][m])
plt.plot(Func["A"], Func["B"])
plt.show()
I am inserting the result so that it is even clearer.
At this point, I'd like each of these curve to change colour based on the value of the numerical values column "Float". I would also like to add a colourbar.
I hope I have been clear enough. Thank you for your support.
PS. Thank you Mr. T for the suggestions. I have asked the question again and added a practical example.
CodePudding user response:
This is surely one of the more ...interesting... dataframe structures I have seen. Not sure how you ended up with that. But this is not the question here, so we import (or construct) a
If you prefer to classify the displayed curves, you can also use a qualitative colormap or create your own