From fcf832c8b2fccef8a16bf1a90853754e8a8be353 Mon Sep 17 00:00:00 2001 From: "Gabriel J. Soto" Date: Mon, 8 Jul 2024 11:24:06 -0600 Subject: [PATCH] hatch symbols are now repeated if multiple CFs per comp --- src/CashFlowPlot.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/CashFlowPlot.py b/src/CashFlowPlot.py index d3cfe2202..896cf4b8a 100644 --- a/src/CashFlowPlot.py +++ b/src/CashFlowPlot.py @@ -126,16 +126,14 @@ def run(self): colorLib *= int(np.ceil(len(compCount)/nColorLib)) compColor = [] compHatch = [] - for i, _ in enumerate(compCount): + for i, count in enumerate(compCount): _cmap = plt.get_cmap(colorLib[i]) _rawCmapList = [_cmap(k) for k in range(_cmap.N)] - compColor += _rawCmapList[defaultEndColor:defaultStartColor:-(defaultEndColor-defaultStartColor)//compCount[i]] + compColor += _rawCmapList[defaultEndColor:defaultStartColor:-(defaultEndColor-defaultStartColor)//count] # handle hatching - posInSequence = int(np.floor(i/nColorLib)) - if posInSequence>0: - compHatch.append(hatchLib[posInSequence]) - else: - compHatch.extend([None]*compCount[i]) + posInSequence = int(np.floor(i/nColorLib)) # seeing if we need to move on to next hatch symbol + hatch = hatchLib[posInSequence] if posInSequence>0 else None # first sequence has no hatch symbol + compHatch.extend([hatch]*count) compColor = pd.DataFrame(compColor).set_axis([cumCashFlow.index.tolist()]).T compHatch = pd.DataFrame(compHatch).set_axis([cumCashFlow.index.tolist()]).T cumCashFlow = cumCashFlow.sort_values(ascending=True)