|
1 | 1 | import numpy as np
|
2 | 2 | import os
|
3 | 3 | import matplotlib.pyplot as plt
|
| 4 | +import matplotlib.ticker as mticker |
4 | 5 | from mpl_toolkits.mplot3d import Axes3D
|
5 | 6 | import matplotlib
|
6 | 7 | from ogcore.constants import (
|
@@ -391,7 +392,7 @@ def ss_3Dplot(
|
391 | 392 | data = (reform_ss[var] - base_ss[var]).T
|
392 | 393 | elif plot_type == "pct_diff":
|
393 | 394 | data = ((reform_ss[var] - base_ss[var]) / base_ss[var]).T
|
394 |
| - cmap1 = matplotlib.cm.get_cmap("jet") |
| 395 | + cmap1 = matplotlib.colormaps.get_cmap("jet") |
395 | 396 | X, Y = np.meshgrid(domain, Jgrid)
|
396 | 397 | fig5, ax5 = plt.subplots(subplot_kw={"projection": "3d"})
|
397 | 398 | ax5.set_xlabel(r"age-$s$")
|
@@ -652,7 +653,7 @@ def ability_bar_ss(
|
652 | 653 | plt.ylabel(r"Percentage Change in " + VAR_LABELS[var])
|
653 | 654 | if plot_title:
|
654 | 655 | plt.title(plot_title, fontsize=15)
|
655 |
| - plt.legend(loc=9, bbox_to_anchor=(0.5, -0.15), ncol=2) |
| 656 | + # plt.legend(loc=9, bbox_to_anchor=(0.5, -0.15), ncol=2) |
656 | 657 | if path:
|
657 | 658 | fig_path1 = os.path.join(path)
|
658 | 659 | plt.savefig(fig_path1, bbox_inches="tight", dpi=300)
|
@@ -1199,14 +1200,17 @@ def inequality_plot(
|
1199 | 1200 | plt.title(plot_title, fontsize=15)
|
1200 | 1201 | vals = ax1.get_yticks()
|
1201 | 1202 | if plot_type == "pct_diff":
|
1202 |
| - ax1.set_yticklabels(["{:,.2%}".format(x) for x in vals]) |
| 1203 | + ticks_loc = ax1.get_yticks().tolist() |
| 1204 | + ax1.yaxis.set_major_locator(mticker.FixedLocator(ticks_loc)) |
| 1205 | + ax1.set_yticklabels(["{:,.2%}".format(x) for x in ticks_loc]) |
1203 | 1206 | plt.xlim(
|
1204 | 1207 | (
|
1205 | 1208 | base_params.start_year - 1,
|
1206 | 1209 | base_params.start_year + num_years_to_plot,
|
1207 | 1210 | )
|
1208 | 1211 | )
|
1209 |
| - plt.legend(loc=9, bbox_to_anchor=(0.5, -0.15), ncol=2) |
| 1212 | + if plot_type == "levels": |
| 1213 | + plt.legend(loc=9, bbox_to_anchor=(0.5, -0.15), ncol=2) |
1210 | 1214 | if path:
|
1211 | 1215 | fig_path1 = os.path.join(path)
|
1212 | 1216 | plt.savefig(fig_path1, bbox_inches="tight", dpi=300)
|
|
0 commit comments