sphinx_gmt.gmtplot
¶
A directive for including a GMT plot in a Sphinx document.
Options¶
The gmtplot
directive supports the following options:
- show-code : bool
- Whether to display the source code. The default can be changed using the
gmtplot_show_code
variable inconf.py
.- language : {‘python’, ‘bash’}
- Specify the language of the source code. The default can be changed using the highlight_language variable in conf.py.
- caption : str
- Caption of the rendered figure.
Additionally, this directive supports options of the figure
and literalinclude
directives.
Configuration options¶
The following options can be set in conf.py
and will apply globally:
- gmtplot_show_code : bool
- Default value for the
show-code
option.- gmtplot_basedir : str
- Base directory, to which
gmtplot
file names are relative to. If None or empty, file names are relative to the directory where the file containing the directive is. However, if it is absolute (starting with/
), it is relative to the top source directory.
Classes
Directive (name, arguments, options, content, …) |
Base class for reStructuredText directives. |
GMTPlotDirective (name, arguments, options, …) |
The gmtplot directive implementation. |
Path |
PurePath subclass that can make system calls. |
Functions
eval_bash (code, code_dir, output_dir, …) |
Execute a multi-line block of bash code and copy the generated image files to specified output directory. |
eval_python (code, code_dir, output_dir, …) |
Execute a multi-line block of Python code and copy the generated image files to specified output directory. |
get_suffix_from_language (language) |
Determine suffix from language. |
guess_language (filename) |
Guess language from suffix of the script. |
render_figure (code, code_dir, language, …) |
Run a GMT code and save the images in output_dir with file names derived from output_base. |
setup (app) |
Add the gmtplot directive to the sphinx app. |