To solve the problem with plt.show() which doesn't display anything, one solution using fig.axes[0] instead of plt.gca() and using display() in Jupyter notebook:
fig = P.draw() ax = fig.axes[0] ax.set_xticklabels(["2030","2040","2050"]) display(fig)