Thursday, May 9, 2013

PL#9: scatter (point) plot

import numpy as np
from mpl_toolkits.mplot3d import Axes3D

import matplotlib.pyplot as plt

# data
x = [1,4,8,    9, 10, 12,  18, 21]
y = [1, 3, 8,  10, 21, 34, 7, 32]
z1 = [4, 6, 8,  23, 19, 2 , 0, 9]
z2 = [10, 5, 2, 11, 18, 8,  11, 15]
z3 = [6, 15, 12, 1, 8, 16,  7, 12]

# plot
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.scatter(x, y, z1, c='r', marker='o')
ax.scatter(x, y, z2, c='g', marker='v')
ax.scatter(x, y, z3, c='b', marker='+')
 
 

No comments:

Post a Comment