I am creating and using a list of complex numbers, and I want to plot them on the plane. This has so far been simple. However, when using two different codes to do the same thing, I'm coming up with two different pictures. Unfortunately, the simpler code is giving me the incorrect graphic.
I have my list roots
, and it has all my points in a list of lists. (I prefer to keep these lists separate as they denote different types of points I'm looking at.)
When I used the code:
allroots=[]
for period in roots:
for i in period:
allroots.append(i)
pic=list_plot([m for m in allroots])
my graphics come out exactly as desired. However, when I use the following code:
plot = sum(list_plot(i) for i in roots)
which is clearly the simpler code, the picture has changed to show points that are not in my list. For example, my list does not have the point 1, (which I have checked multiple times because that would break math) and yet this simpler code consistently plots a point at 1, as well as a few other seemingly random points.
Can anyone explain what's happening or give a better code to use? I'd really like to plot my list of lists without having to compile them into a single list, but this code is causing me problems, and I have no idea why.