From 3845c991219b758f686f45f74a74b14b5d4692ba Mon Sep 17 00:00:00 2001 From: Yoel Date: Fri, 21 Jun 2024 12:48:24 -0500 Subject: [PATCH] Minor edits to enhancements --- biosteam/plots/plots.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/biosteam/plots/plots.py b/biosteam/plots/plots.py index b4876628..b64b3828 100644 --- a/biosteam/plots/plots.py +++ b/biosteam/plots/plots.py @@ -662,8 +662,9 @@ def plot_spearman_2d(rhos, top=None, name=None, color_wheel=None, index=None, Spearman's rank correlation coefficients to be plotted. top=None : float, optional Number of parameters to plot (from highest values). - color_wheel=None: list, optional - Iterable, either (A) of color objects with attribute 'RGBn' giving tuples of RGBn values, or (B) of tuples of RGBn values. + color_wheel=None: Iterable, optional + Iterable of colorpalette.Color objects or RGBn values. + Returns ------- fig : matplotlib Figure @@ -688,12 +689,10 @@ def plot_spearman_2d(rhos, top=None, name=None, color_wheel=None, index=None, if not color_wheel: color_wheel = CABBI_colors.wheel() fig, ax = plt.subplots() for i, rho in enumerate(rhos): - if isinstance(color_wheel[N - i - 1], tuple): - plot_spearman_1d(rho, color=color_wheel[N - i - 1], s=s, offset=i, - fig=fig, ax=ax, style=False, sort=False, top=None) - else: - plot_spearman_1d(rho, color=color_wheel[N - i - 1].RGBn, s=s, offset=i, - fig=fig, ax=ax, style=False, sort=False, top=None) + color = color_wheel[N - i - 1] + if hasattr(color, 'RGBn'): color = color.RGBn + plot_spearman_1d(rho, color=color, s=s, offset=i, + fig=fig, ax=ax, style=False, sort=False, top=None) # Plot central line yranges = [(s/2 + s*i - 1., 1.) for i in range(len(rhos[0]))] format_spearman_plot(ax, index, name, yranges, xlabel)