I am trying to understand how unpacking could work with matplotlib in regards to condensing and simplifying code. Say:
P = array([[0, 0, 0], [1, 1, 1], [2, 2, 2], [3, 3, 3],[4, 4, 4]])
and I wanted to plot four points at each of these coordinates ((0,0,0), (1,1,1), etc). I have seen * be used before with regard to unpacking and then plotting data points but I don't know what I'm doing wrong. I have the following code:
import numpy as np
import matplotlib.pyplot as plt
import mpl_toolkits.mplot3d.axes3d as p3
import matplotlib.animation as animation
import matplotlib as mpl
fig = plt.figure()
ax = p3.Axes3D(fig)
ax.set_xlim3d([0, 5])
ax.set_xlabel('X')
ax.set_ylim3d([0, 5])
ax.set_ylabel('Y')
ax.set_zlim3d([0, 5])
ax.set_zlabel('Z')
ax.set_title('3D Test')
P = array([[0, 0, 0], [1, 1, 1], [2, 2, 2], [3, 3, 3],[4, 4, 4]])
[ax.plot(*p, marker='o', ls='None')[0] for i in range(4)]
I'd thought that p could be unpacked into the coordinates and then plotted but it's not working at the moment. Any ideas on where I am going wrong?
At the moment this is being produced

