Python Forum

Full Version: 3d graph points
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Below is some code and it wont map a graph with the points on it for some reason???

import numpy as np
import csv
#import the ploting library bits
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
%matplotlib inline    
# if your device supports it, use "auto" not "inline" to get a seperate window, with controls!

# the 2 lines below set up the 3d plot
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')

lr=[]    # setup the arrays for the data so they can be refered to in the read process
hn=[]
ac=[]

with open('vert.csv') as csvDataFile:   # this reads the data rows & appends it to previous row
    csvReader = csv.reader(csvDataFile) 
    x = np.asfarray(lr[1:])
    y = np.asfarray(hn[2:])
    z = np.asfarray(ac[3:])*100
    
    for row in csvReader:
           lr.append(row[1])
           hn.append(row[2])
           ac.append(row[3])

ax.scatter(x, y, z, c='r', marker='o', cmap='green', s=100)

ax.set_ylabel('hidden nodes')    # axis labels
ax.set_xlabel('learning rate')
ax.set_zlabel('accuracy')


plt.show()
No error showing up - simply the points won't plot! There's a graph but no points