Argument does not support iteration. How to resolve?

Asked

Viewed 16 times

0

I am trying to apply zip to the x, y and z lists, but when running the program I get the following error: izip argument #1 must support iteration. Can someone help me fix my mistake?

from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.figure import Figure 
from mpl_toolkits.mplot3d.art3d import Poly3DCollection
import numpy as np    
from matplotlib import pyplot as plt

fig = Figure((5.0, 5.0), dpi=80, tight_layout=True, frameon=False)  #linhas referentes a criação do canvas de plotagem
canvas = FigureCanvas(fig)
axes = fig.add_subplot(111, projection='3d')

xi = np.linspace(0., 9.0, 20)
yi = list(np.linspace(0., 7.0, 20))
zi = list(np.linspace(0., 2.0, 20))
yf = 2*xi -5
xi = list(xi)
yf = list(yf)
x = xi + xi
y = yi + yf
z = zi + zi
verts = list(zip(x, y, z))

axes.add_collection3d(Poly3DCollection(verts, facecolor = 'black', alpha=0.5 ), zs='z')  #plota figura
fig = plt.figure()
axes = fig.gca(projection='3d')
  • Out of curiosity, why only the yf is not a list? And you need these data as lists?

  • Yf is a list too, I forgot to turn it, but,already edited and I took the opportunity to enter the rest of the code, because I suspect now that the problem is in the plotting

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.