![]() |
.pyplot has not attribute zlim - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: .pyplot has not attribute zlim (/thread-12386.html) |
.pyplot has not attribute zlim - SchroedingersLion - Aug-22-2018 Hey guys, can someone explain to me this error? "AttributeError: module 'matplotlib.pyplot' has no attribute 'zlim'" I try to read in coordinates from a txt file. In each row, the coordinates are separated by a single tabulator. from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt import csv fig=plt.figure() ax=fig.add_subplot(111, projection='3d') x=[] y=[] z=[] with open('fcc_coordinates_a=1.500000_5rows_5columns_5layers.dat') as csv_file: plots = csv.reader(csv_file, delimiter="\t") for row in plots: x.append(float(row[0])) y.append(float(row[1])) z.append(float(row[2])) ax.scatter(x,y,z,c='r',marker='o') ax.set_xlabel('x axis') ax.set_ylabel('y axis') ax.set_zlabel('z axis') plt.show() plt.xlim(0,7.5) plt.ylim(0,7.5) plt.zlim(0,7.5)Regards RE: .pyplot has not attribute zlim - buran - Aug-22-2018 please, post the full traceback in error tags RE: .pyplot has not attribute zlim - SchroedingersLion - Aug-22-2018 If I run it, I get a plot as a result, but the zlim did not work and it gives: I am using Spyder.
RE: .pyplot has not attribute zlim - SchroedingersLion - Aug-24-2018 No one having an idea =( ? Does that mean there might be something wrong with Spyder/Python installation? RE: .pyplot has not attribute zlim - heras - Aug-24-2018 Just a shot in the dark ... maybe try plt.set_zlim(0,7.5)? https://matplotlib.org/examples/mplot3d/contour3d_demo3.html RE: .pyplot has not attribute zlim - SchroedingersLion - Aug-25-2018 Thank you. plt.set_zlim(x.y) doesn't work any better, but from your link it looks like using ax.set_zlim(x,y) is the right way to go. And this gets rid of the error. |