Commit 9afaf64c authored by syz's avatar syz
Browse files

updated plot_scree to use kwargs

parent 16ec364f
......@@ -152,7 +152,7 @@ h5_s = h5_svd_group['S']
abun_maps = np.reshape(h5_u[:,:25], (num_rows, num_cols, -1))
# Visualize the variance / statistical importance of each component:
px.plot_utils.plotScree(h5_s, title='Note the exponential drop of variance with number of components')
px.plot_utils.plot_scree(h5_s, title='Note the exponential drop of variance with number of components')
# Visualize the eigenvectors:
first_evecs = h5_v[:9, :]
......
......@@ -152,7 +152,7 @@ h5_s = h5_svd_group['S']
abun_maps = np.reshape(h5_u[:,:25], (num_rows, num_cols, -1))
# Visualize the variance / statistical importance of each component:
px.plot_utils.plotScree(h5_s, title='Note the exponential drop of variance with number of components')
px.plot_utils.plot_scree(h5_s, title='Note the exponential drop of variance with number of components')
# Visualize the eigenvectors:
first_evecs = h5_v[:9, :]
......
......@@ -690,7 +690,7 @@ def plot_complex_loop_stack(loop_stack, x_axis, heading='BE Loops', subtitle='Ei
###############################################################################
def plotScree(scree, title='Scree'):
def plot_scree(scree, title='Scree', **kwargs):
"""
Plots the scree or scree
......@@ -705,17 +705,19 @@ def plotScree(scree, title='Scree'):
---------
fig, axes
"""
fig203 = plt.figure(figsize=(6.5, 6))
axes203 = fig203.add_axes([0.1, 0.1, .8, .8]) # left, bottom, width, height (range 0 to 1)
axes203.loglog(np.arange(len(scree)) + 1, scree, 'b', marker='*')
axes203.set_xlabel('Principal Component')
axes203.set_ylabel('Variance')
axes203.set_title(title)
axes203.set_xlim(left=1, right=len(scree))
axes203.set_ylim(bottom=np.min(scree), top=np.max(scree))
fig203.canvas.set_window_title("Scree")
return fig203, axes203
fig = plt.figure(figsize=(6.5, 6))
axis = fig.add_axes([0.1, 0.1, .8, .8]) # left, bottom, width, height (range 0 to 1)
kwargs.update({'color': kwargs.pop('color', 'b')})
kwargs.update({'marker': kwargs.pop('marker', '*')})
axis.loglog(np.arange(len(scree)) + 1, scree, **kwargs)
axis.set_xlabel('Component')
axis.set_ylabel('Variance')
axis.set_title(title)
axis.set_xlim(left=1, right=len(scree))
axis.set_ylim(bottom=np.min(scree), top=np.max(scree))
fig.canvas.set_window_title("Scree")
return fig, axis
# ###############################################################################
......
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