add to org function mpl-prologue an argument to define mplstyle

This commit is contained in:
2022-12-04 20:23:54 +01:00
parent 7542f19d77
commit 382206928c

View File

@@ -891,15 +891,20 @@ returns: file name varible with extension for the org src header :var
usage: #+HEADER: :var fname=(mpl-var \"ledger-income\")
"
(concat filename (by-backend (latex ".pgf") (article-latex ".pgf") (t ".svg"))))
(defun mpl-prologue ()
(defun mpl-prologue (&optional mplstyle)
"\
Matplotlib
returns: style settings for a org src python matplotlib code block
- for LaTeX export it is not set.
- for other export it is set to: import matplotlib.pyplot as plt;plt.style.use('dark_background');
- for other export it is set to load kpfonts and my.mplstyle.
Optional Argument MPLSTYLE:
- my (default)
- my-tex (uses latex to render fonts)
usage: #+HEADER: :prologue (mpl-prologue)
usage:
#+HEADER: :prologue (mpl-prologue)
#+HEADER: :prologue (mpl-prologue \"my-tex\")
"
(by-backend (latex "")
(article-latex "")
@@ -915,12 +920,13 @@ import matplotlib.pyplot as plt
styles = plt.style.core.read_style_directory('%s')
plt.style.core.update_nested_dict(plt.style.library, styles)
try:
plt.style.use('my')
plt.style.use('%s')
except:
pass
"
(concat config-dir "scripts/fonts")
(concat config-dir "scripts/matplotlib-stylelib")))))
(concat config-dir "scripts/matplotlib-stylelib")
(or mplstyle "my")))))
(use-package ol-notmuch
:after (org))