Commit 08618d0f authored by Leodegario Lorenzo II's avatar Leodegario Lorenzo II
Browse files

Set missing variables

parent aaaacff2
import numpy
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.transforms as transforms
def exp_var(exp_var_ratio, tol=0.90):
......@@ -23,14 +24,14 @@ def exp_var(exp_var_ratio, tol=0.90):
exp_var = (exp_var_ratio).cumsum()
# Get index where exp_var exceeds tolerance
thresh = np.min(np.arange(len(s))[exp_var >= tol])
thresh = np.min(np.arange(len(exp_var))[exp_var >= tol])
# Initialize figure
fig = plt.figure(figsize=(8, 6))
ax = fig.add_subplot(111)
# Plot explained varianced
ax.plot(range(len(s)), exp_var, lw=4.0)
ax.plot(range(len(exp_var)), exp_var, lw=4.0)
# Plot threshold line
ax.axvline(thresh, linestyle='--', lw=2.5, color='tab:orange')
......@@ -42,7 +43,7 @@ def exp_var(exp_var_ratio, tol=0.90):
# Set ylim
ax.set_ylim([min(exp_var), 1.05])
ax.set_xlim([0., len(s)])
ax.set_xlim([0., len(exp_var)])
# Remove spines
ax.spines['top'].set_visible(False)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment