the functions below each plot a single numpy array
plot1D, plot2D, and plot3D take arrays with 1, 2, and 3 columns, respectively
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
def plot1D(data):
x=np.arange(len(data))
plot2D(np.hstack((np.transpose(x), data)))
def plot2D(data):
# type: (object) -> object
#if 2d, make a scatter
plt.plot(data[:,0], data[:,1], *args, **kwargs)
def plot3D(data):
#if 3d, make a 3d scatter
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.plot(data[:,0], data[:,1], data[:,2], *args, **kwargs)
I would like the ability to input a list of 1, 2, or 3d arrays and plot all arrays from the list onto one figure
I have added the looping elements, but am unsure how hold a figure and add additional plots...
def plot1D_list(data):
for i in range(0, len(data)):
x=np.arange(len(data[i]))
plot2D(np.hstack((np.transpose(x), data[i])))
def plot2D_list(data):
# type: (object) -> object
#if 2d, make a scatter
for i in range(0, len(data)):
plt.plot(data[i][:,0], data[i][:,1], *args, **kwargs)
def plot3D_list(data):
#if 3d, make a 3d scatter
for i in range(0, len(data)):
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.plot(data[i][:,0], data[i][:,1], data[i][:,2], *args, **kwargs)