add to org function mpl-prologue an argument to define mplstyle
This commit is contained in:
@@ -891,15 +891,20 @@ returns: file name varible with extension for the org src header :var
|
|||||||
usage: #+HEADER: :var fname=(mpl-var \"ledger-income\")
|
usage: #+HEADER: :var fname=(mpl-var \"ledger-income\")
|
||||||
"
|
"
|
||||||
(concat filename (by-backend (latex ".pgf") (article-latex ".pgf") (t ".svg"))))
|
(concat filename (by-backend (latex ".pgf") (article-latex ".pgf") (t ".svg"))))
|
||||||
(defun mpl-prologue ()
|
(defun mpl-prologue (&optional mplstyle)
|
||||||
"\
|
"\
|
||||||
Matplotlib
|
Matplotlib
|
||||||
|
|
||||||
returns: style settings for a org src python matplotlib code block
|
returns: style settings for a org src python matplotlib code block
|
||||||
- for LaTeX export it is not set.
|
- 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 "")
|
(by-backend (latex "")
|
||||||
(article-latex "")
|
(article-latex "")
|
||||||
@@ -915,12 +920,13 @@ import matplotlib.pyplot as plt
|
|||||||
styles = plt.style.core.read_style_directory('%s')
|
styles = plt.style.core.read_style_directory('%s')
|
||||||
plt.style.core.update_nested_dict(plt.style.library, styles)
|
plt.style.core.update_nested_dict(plt.style.library, styles)
|
||||||
try:
|
try:
|
||||||
plt.style.use('my')
|
plt.style.use('%s')
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
"
|
"
|
||||||
(concat config-dir "scripts/fonts")
|
(concat config-dir "scripts/fonts")
|
||||||
(concat config-dir "scripts/matplotlib-stylelib")))))
|
(concat config-dir "scripts/matplotlib-stylelib")
|
||||||
|
(or mplstyle "my")))))
|
||||||
|
|
||||||
(use-package ol-notmuch
|
(use-package ol-notmuch
|
||||||
:after (org))
|
:after (org))
|
||||||
|
|||||||
Reference in New Issue
Block a user