.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/plot_functional_api.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_plot_functional_api.py: Functional API ============== Create memes using the :func:`~memeplotlib.meme` function with text styling options and figure access. .. GENERATED FROM PYTHON SOURCE LINES 10-15 Customizing Text ----------------- Pass ``font``, ``color``, and ``style`` keyword arguments to control text appearance. .. GENERATED FROM PYTHON SOURCE LINES 15-23 .. code-block:: Python import memeplotlib as memes memes.meme( "drake", "writing tests", "shipping to prod", font="impact", color="yellow", show=False, ) .. image-sg:: /auto_examples/images/sphx_glr_plot_functional_api_001.png :alt: plot functional api :srcset: /auto_examples/images/sphx_glr_plot_functional_api_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none (
, ) .. GENERATED FROM PYTHON SOURCE LINES 24-29 Getting the Figure Back ------------------------ :func:`~memeplotlib.meme` returns a ``(Figure, Axes)`` tuple, so you can continue to modify the plot. .. GENERATED FROM PYTHON SOURCE LINES 29-34 .. code-block:: Python fig, ax = memes.meme( "distracted", "my project", "new framework", "me", show=False, ) .. rst-class:: sphx-glr-script-out .. code-block:: pytb Traceback (most recent call last): File "/home/runner/work/memeplotlib/memeplotlib/examples/plot_functional_api.py", line 30, in fig, ax = memes.meme( File "/home/runner/work/memeplotlib/memeplotlib/src/memeplotlib/_api.py", line 89, in meme tmpl = _resolve_template(template) File "/home/runner/work/memeplotlib/memeplotlib/src/memeplotlib/_template.py", line 434, in _resolve_template return reg.get(template) File "/home/runner/work/memeplotlib/memeplotlib/src/memeplotlib/_template.py", line 344, in get return Template.from_memegen(template_id, api_base=self._api_base) File "/home/runner/work/memeplotlib/memeplotlib/src/memeplotlib/_template.py", line 128, in from_memegen raise TemplateNotFoundError(f"Template '{template_id}' not found") memeplotlib._template.TemplateNotFoundError: Template 'distracted' not found .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.823 seconds) .. _sphx_glr_download_auto_examples_plot_functional_api.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_functional_api.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_functional_api.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_functional_api.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_