From 614b08bf06ba40d6723f6461cc7c77f76d80b9c0 Mon Sep 17 00:00:00 2001 From: CoronaBeachIDme <93943812+CoronaBeachIDme@users.noreply.github.com> Date: Thu, 22 Feb 2024 09:13:29 -0500 Subject: [PATCH] Update tree_graph.py (#53) * Update tree_graph.py Panda 2.0.3 no longer supports column.iteritems() and requires to the generic use of column.items() * updates to make compliance with Matplotlib 3.8 updates to make compliance with Matplotlib 3.8 * updates to support matplotlib 3.8 updated to change set_horizontalalignment('left') to set_tick_params(left = 'true') * matplotlib 3.8 changes matplotlib 3.8 changes * Delete .DS_Store * Delete pyfair/report/.DS_Store * Update to support matplotlib 3.8 * Update .gitignore --------- Co-authored-by: Corey Neskey <4606261+cneskey@users.noreply.github.com> --- pyfair/report/distribution.py | 2 +- pyfair/report/exceedence.py | 3 ++- pyfair/report/tree_graph.py | 7 ++----- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/pyfair/report/distribution.py b/pyfair/report/distribution.py index 2a8735d..c8e7055 100644 --- a/pyfair/report/distribution.py +++ b/pyfair/report/distribution.py @@ -131,4 +131,4 @@ def generate_image(self): space = np.linspace(0, xmax, 1000) tyax.plot(space, beta_curve.pdf(space)) plt.margins(0) - return (fig, ax) + return (fig, ax) \ No newline at end of file diff --git a/pyfair/report/exceedence.py b/pyfair/report/exceedence.py index 7d7dd84..3782a97 100644 --- a/pyfair/report/exceedence.py +++ b/pyfair/report/exceedence.py @@ -78,6 +78,7 @@ def _generate_loss_curve(self, name, ax, space, loss_expectancy): ax.axes.yaxis.set_major_formatter(StrMethodFormatter('{x:,.0f}%')) ax.axes.xaxis.set_major_formatter(StrMethodFormatter(self._currency_prefix + '{x:,.0f}')) ax.axes.xaxis.set_tick_params(rotation=-45) + ax.axes.xaxis.set_tick_params(left = 'true') for tick in ax.axes.xaxis.get_major_ticks(): tick.label1.set_horizontalalignment('left') - ax.axes.set_title('Loss Exceedence Curve', fontsize=20) + ax.axes.set_title('Loss Exceedence Curve', fontsize=20) \ No newline at end of file diff --git a/pyfair/report/tree_graph.py b/pyfair/report/tree_graph.py index 1520e40..60f2bac 100644 --- a/pyfair/report/tree_graph.py +++ b/pyfair/report/tree_graph.py @@ -2,9 +2,7 @@ import pandas as pd -import matplotlib import matplotlib.pyplot as plt - from matplotlib.patches import Patch from matplotlib.patches import Rectangle from matplotlib.collections import PatchCollection @@ -126,7 +124,7 @@ def _generate_text(self, row, ax): supplied = row['status'] == 'Supplied' # Raw inputs will have a list if 'raw' in row.index: - if type(row['raw']) == list: + if isinstance(row['raw'], list): raw = True else: raw = False @@ -142,7 +140,6 @@ def _generate_text(self, row, ax): output = '\n'.join([ key + ' ' + value.rjust(value_just) for key, value - in data.items() ]) elif supplied: @@ -225,4 +222,4 @@ def generate_image(self): self._generate_rects(ax) self._data.apply(self._generate_lines, args=[ax], axis=1) self._generate_legend(ax) - return (fig, ax) + return (fig, ax) \ No newline at end of file