Note
Go to the end to download the full example code.
Functional API#
Create memes using the meme() function with text styling
options and figure access.
Customizing Text#
Pass font, color, and style keyword arguments to control text
appearance.
import memeplotlib as memes
memes.meme(
"drake", "writing tests", "shipping to prod",
font="impact", color="yellow", show=False,
)

(<Figure size 1200x1878 with 1 Axes>, <Axes: >)
Getting the Figure Back#
meme() returns a (Figure, Axes) tuple, so you can
continue to modify the plot.
fig, ax = memes.meme(
"distracted", "my project", "new framework", "me",
show=False,
)
Traceback (most recent call last):
File "/home/runner/work/memeplotlib/memeplotlib/examples/plot_functional_api.py", line 30, in <module>
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
Total running time of the script: (0 minutes 0.823 seconds)