I’m trying to make a legend for my subplot using Python. Here’s part of my code:
L1, =axs[1].scatter(x = phi, y = Evala, color = 'teal',s=60)
This method works when I was not using subplot, but now it returns me the following error message:
TypeError: cannot unpack non-iterable PathCollection object
I’m not pretty sure how I can fix this issue. Thanks for the help!
Advertisement
Answer
The code has an object which should not be present there as you are assigning values to the variable L1
L1, =axs[1].scatter(x = phi, y = Evala, color = 'teal',s=60)
Try this,
L1 =axs[1].scatter(x = phi, y = Evala, color = 'teal',s=60)
This will work