How do a get two x-axes and two y-axes in a az.plot_posterior

I would just suggest that whatever customization one wants done, it should be done by working with the ax object. There’s basically never any need to go in and hack the source files.

For example, ticking the top, left, and right:

fig, ax = plt.subplots()
az.plot_posterior(idata.prior, var_names=['mu'], ax=ax);
[spine.set_visible(True) for spine in ax.spines.values()]
ax.yaxis.set_major_locator(AutoLocator())
ax.xaxis.tick_top()
ax.tick_params(axis='y', which='both', tick2On=True, label2On=True)
plt.show()

Untitled

1 Like