Renderer Modules¶
Your code must at least implement a main() function that accepts
the matplotlib instance as its only paramter and returns a figure
def main(plt):
f, ax = plt.subplots(1, 1, figsize=(6, 2))
ax.plot(...)
return f
Artists¶
Your function may return the figure alongside a list/tuple of additional artists:
def main(plt):
f, ax = plt.subplots(1, 1, figsize=(6, 2))
ax.plot(...)
lgd = ax.legend(...)
return f, (lgd,)
RC Settings¶
Your module may define additional RC settings for Matplotlib and Seaborn as
well as set a stylesheet and a pre_hook and a post_hook
which will run before and after the plotting.
from contextlib import contextmanager
def main(plt):
f, ax = plt.subplots(1, 1, figsize=(6, 2))
ax.plot(...)
lgd = ax.legend(...)
return f, (lgd,)
sns_params = {
'font': 'serif',
}
rc_params = {
'font.size': 9,
}
stylesheet = 'grayscale'
def pre_hook(plt):
plt.style.use('grayscale')
def post_hook(plt):
pass
See also
Global RC settings in conf.py: rc_params, sns_params, stylesheet