I'm not quite sure how to describe my problem, so I'm having trouble googling for solutions. Forgive me if the answer has been described elsewhere.
I have a function that compares two things and returns a tuple of a value and a list of values, where the first value is always part of the list eg: (a, [m,n,a,o])
. I have a list of things that I want to compare [thing1, thing2, thing3, thing4]
. I've got a function that loops through the things and compares them, but I'm having trouble figuring out how to plot them:
def compare_thing1(things=[thing2,thing3,thing4]):
for thing in things:
*compare thing1 to thing, add to dataframe*
plot
So if thing1
to thing2
comparison returns (10, [8,9,10,11,12])
, the thing3
comparison returns (25, [24,25,26,27])
and thing4
comparison returns (30, [28,29,30,31,32,33...])
, I want a graph that looks like this:
In other words, the X position is determined by the first value, and then the values in the list are plotted on the y axis.
I think I could sort of cloodge this together by creating a bunch of (x,y) coordinates from each comparison, but I was wondering if there's a better way to do this with Series
objects or something. The problem is that all of the lists are different lengths.
Oh, also not sure if performace is an issue, each of the comparisons can be thousands of values long.