Skip to content

Commit

Permalink
Change order of writing graphs in taxcalcio.py module
Browse files Browse the repository at this point in the history
  • Loading branch information
martinholmer committed May 9, 2024
1 parent 7bc95db commit e488de5
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions taxcalc/taxcalcio.py
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,15 @@ def write_graph_files(self):
"""
pos_wght_sum = self.calc.total_weight() > 0.0
fig = None
# percentage-aftertax-income-change graph
pch_fname = self._output_filename.replace('.csv', '-pch.html')
pch_title = 'PCH by Income Percentile'
if pos_wght_sum:
fig = self.calc_base.pch_graph(self.calc, pop_quantiles=False)
write_graph_file(fig, pch_fname, pch_title)
else:
reason = 'No graph because sum of weights is not positive'
TaxCalcIO.write_empty_graph_file(pch_fname, pch_title, reason)
# average-tax-rate graph
atr_fname = self._output_filename.replace('.csv', '-atr.html')
atr_title = 'ATR by Income Percentile'
Expand All @@ -694,15 +703,6 @@ def write_graph_files(self):
else:
reason = 'No graph because sum of weights is not positive'
TaxCalcIO.write_empty_graph_file(mtr_fname, mtr_title, reason)
# percentage-aftertax-income-change graph
pch_fname = self._output_filename.replace('.csv', '-pch.html')
pch_title = 'PCH by Income Percentile'
if pos_wght_sum:
fig = self.calc_base.pch_graph(self.calc, pop_quantiles=False)
write_graph_file(fig, pch_fname, pch_title)
else:
reason = 'No graph because sum of weights is not positive'
TaxCalcIO.write_empty_graph_file(pch_fname, pch_title, reason)
if fig:
del fig
gc.collect()
Expand Down

0 comments on commit e488de5

Please sign in to comment.