diff --git a/docs/2dplots.py b/docs/2dplots.py index 0331dce01..fe1d4ef56 100644 --- a/docs/2dplots.py +++ b/docs/2dplots.py @@ -344,6 +344,7 @@ ax.pcolormesh(data, cmap="magma", colorbar="b") ax = fig.subplot(gs[1], title="Logarithmic normalizer with norm='log'") ax.pcolormesh(data, cmap="magma", norm="log", colorbar="b") +fig.show() # %% [raw] raw_mimetype="text/restructuredtext" @@ -431,6 +432,7 @@ ax.colorbar(m, loc="b") ax.format(title=f"{mode.title()}-skewed + {fair} scaling") i += 1 +fig.show() # %% [raw] raw_mimetype="text/restructuredtext" # .. _ug_discrete: @@ -531,6 +533,7 @@ colorbar="b", colorbar_kw={"locator": 180}, ) +fig.show() # %% [raw] raw_mimetype="text/restructuredtext" tags=[] # .. _ug_autonorm: diff --git a/docs/basics.py b/docs/basics.py index d45a72aeb..5b37cdeaa 100644 --- a/docs/basics.py +++ b/docs/basics.py @@ -86,6 +86,7 @@ # fig = uplt.figure(suptitle='Single subplot') # equivalent to above # ax = fig.subplot(xlabel='x axis', ylabel='y axis') ax.plot(data, lw=2) +fig.show() # %% [raw] raw_mimetype="text/restructuredtext" @@ -184,6 +185,7 @@ ylabel="ylabel", ) axs[2].plot(data, lw=2) +fig.show() # fig.save('~/example2.png') # save the figure # fig.savefig('~/example2.png') # alternative @@ -301,6 +303,7 @@ axs[1, :1].format(fc="sky blue") axs[-1, -1].format(fc="gray4", grid=False) axs[0].plot((state.rand(50, 10) - 0.5).cumsum(axis=0), cycle="Grays_r", lw=2) +fig.show() # %% [raw] raw_mimetype="text/restructuredtext" @@ -361,6 +364,7 @@ suptitle="Quick plotting demo", ) fig.colorbar(m, loc="b", label="label") +fig.show() # %% [raw] raw_mimetype="text/restructuredtext" @@ -565,3 +569,4 @@ for ax, style in zip(axs, styles): ax.format(style=style, xlabel="xlabel", ylabel="ylabel", title=style) ax.plot(data, linewidth=3) +fig.show() diff --git a/docs/conf.py b/docs/conf.py index 52f603568..66f4edff6 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -13,6 +13,7 @@ # Import statements import datetime +import logging import os import re import subprocess @@ -78,10 +79,17 @@ def __getattr__(self, name): except Exception: pass +# Silence font discovery warnings like "findfont: Font family ..." +for _logger_name in ("matplotlib", "matplotlib.font_manager"): + _logger = logging.getLogger(_logger_name) + _logger.setLevel(logging.ERROR) + _logger.propagate = False + # Suppress deprecated rc key warnings from local configs during docs builds. try: from ultraplot.internals.warnings import UltraPlotWarning + warnings.filterwarnings("ignore") warnings.filterwarnings( "ignore", category=UltraPlotWarning, @@ -103,6 +111,10 @@ def _reset_ultraplot(gallery_conf, fname): import ultraplot as uplt except Exception: return + for _logger_name in ("matplotlib", "matplotlib.font_manager"): + _logger = logging.getLogger(_logger_name) + _logger.setLevel(logging.ERROR) + _logger.propagate = False uplt.rc.reset() @@ -350,7 +362,7 @@ def _reset_ultraplot(gallery_conf, fname): nbsphinx_execute = "auto" # Suppress warnings in nbsphinx kernels without injecting visible cells. -os.environ.setdefault("PYTHONWARNINGS", "ignore::UserWarning") +os.environ["PYTHONWARNINGS"] = "ignore" # Sphinx gallery configuration sphinx_gallery_conf = {