0

Basically, I am making a basketball simulation. I have textfile with over 100,000 simulations. The axes of the 3D scatter plot should take the 2nd,3rd, and 4th columnns (representing 3 different physics parameter) of a basketball. However, there is a 5th column that represents if it the basketball has gone in or misses, based on the 3 parameters. I can plot the 3 parameters easy, but how do I go about plotting an "x" (miss) or an "o" (make)for the corresponding 3 parameters?

I am currently using PlotLy to do the visualization. Any help would be appreciated friends!

1 Answers1

0

I don't know how to do it with plotly. But in matplotlib it can be easily done:

Code:

import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import axes3d

# generate some data
x = np.random.randn(10)
y = np.random.randn(10)
z = np.random.randn(10)

misses = np.zeros(10)
misses[5] = 1  # add a miss point

fig = plt.figure(figsize=(5, 5))
ax = fig.add_subplot(projection='3d')

# plot regular points: misses = 0
ax.scatter(x[misses == 0], y[ misses == 0], z[ misses == 0], s=100, marker='o', c='g')
# plot regular misses: points = 1
ax.scatter(x[misses == 1], y[ misses == 1], z[ misses == 1], s=100, marker='x', c='r')

plt.show()

Plot:

img

trsvchn
  • 8,033
  • 3
  • 23
  • 30