Skip to content

Instantly share code, notes, and snippets.

@millawell
Created July 18, 2014 20:27
Show Gist options
  • Save millawell/404f5101eb1b26008224 to your computer and use it in GitHub Desktop.
Save millawell/404f5101eb1b26008224 to your computer and use it in GitHub Desktop.
import pandas as pd
import numpy as np
import scipy as sc
from scipy import stats
import matplotlib.pyplot as plt
data = np.loadtxt('Implementation2.mat')
data = pd.DataFrame(data, columns=['time', 'q0', 'q1', 'q2', 'dq0', 'dq1', 'dq2', 'qd0', 'qd1', 'qd2', 'tau0', 'tau1', 'tau2', 'x0', 'x1', 'x2', 'dx0', 'dx1', 'dx2', 'xd0', 'xd1', 'xd2' ])
X = data[['time','q0','q1', 'q2','qd0','qd1', 'qd2']]
[n,d] = X.shape
#Color Palette
colors = ["#1f77b4", "#ff7f0e", "#ffbb78", "#2ca02c", "#98df8a", "#d62728", "#ff9896", "#9467bd", "#c5b0d5", "#8c564b", "#c49c94", "#e377c2", "#f7b6d2", "#7f7f7f", "#c7c7c7", "#bcbd22", "#dbdb8d", "#17becf", "#9edae5"]
f = plt.figure(1);f.clf()
for i in range(0,3):
ax = f.add_subplot(3,1,i)
for k,col in enumerate(["q","qd"]):
ax.plot(X["time"], X[col+str(i)], label=col+str(i), linewidth=3.0, alpha=.7, color=colors[k])
ax.legend(loc=4)
ax.set_xlabel("time in seconds")
ax.set_ylabel("joint configuration")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment