[Doc] Automatically ignore unwanted Matplotlib output in gallery

This commit is contained in:
Ray Speth 2024-03-20 09:24:51 -04:00 committed by Ingmar Schoegl
parent 32a6d3da4e
commit 3fdd45e357
4 changed files with 7 additions and 5 deletions

View File

@ -53,6 +53,7 @@ sphinx_gallery_conf = {
'ignore_pattern': r'(__.*__\.py|test_examples\.m)',
'image_srcset': ["2x"],
'remove_config_comments': True,
'ignore_repr_types': r'matplotlib\.(text|axes|legend)',
'examples_dirs': [
'../samples/python/',
'../samples/cxx/',

View File

@ -81,7 +81,8 @@ profile = flame.to_array()
fig, ax = plt.subplots()
ax.plot(profile.grid * 100, profile.T, ".-")
_ = ax.set(xlabel="Distance [cm]", ylabel="Temperature [K]")
ax.set_xlabel("Distance [cm]")
ax.set_ylabel("Temperature [K]")
# %%
@ -93,8 +94,8 @@ ax.plot(profile.grid * 100, profile("CO2").X, "--", label="CO$_2$")
ax.plot(profile.grid * 100, profile("H2O").X, label="H$_2$O")
ax.legend(loc="best")
plt.xlabel("Distance (cm)")
_ = ax.set(xlabel="Distance [cm]", ylabel="Mole fraction [-]")
ax.set_xlabel("Distance [cm]")
ax.set_ylabel("Mole fraction [-]")
# %%
# Sensitivity Analysis

View File

@ -355,7 +355,7 @@ ax.plot(100 * X_Li_ca, E_cell_therm,
linewidth=0.0, marker="o", markerfacecolor="none", label="Thermodynamic")
ax.set(ylim=[2.5, 4.3], xlabel="Li Fraction in Cathode (%)",
ylabel="Open Circuit Potential (V)")
_ = ax.legend()
ax.legend()
# %%
# As one would expect, the two approaches give identical results. While both methods are

View File

@ -253,7 +253,7 @@ ax.text(430, 318, "p = 97 bar", color=color[5], rotation=-12)
ax.text(960, 320, "p = 600 bar", color=color[9], rotation=-68)
ax.set_xlabel("Density [kg/m$^3$]")
ax.set_ylabel("Temperature [K]")
_ = ax.legend(handles=[ideal_line[0], RK_line[0], CP_line[0]])
ax.legend(handles=[ideal_line[0], RK_line[0], CP_line[0]])
#%%
# The figure compares :math:`T-\rho` plots for ideal, R-K, and Helmholtz EoS at