az.plot_trace just does matplotlib stuff, so all the usual matplotlib rules apply.
In this case, you can just call plt.tight_layout() after az.plot_trace(idata). If you wanted to be fancy, you can use plt.gcf() to get the figure object that arviz created and call fig.tight_layout() or fig.use_constrained_layout(), as in:
axes = az.plot_trace(idata)
fig = plt.gcf()
fig.tight_layout()
plt.show()