sphinx_gmt.gmtplot


A directive for including a GMT plot in a Sphinx document.

Options

The gmtplot directive supports the following options:

show-codebool

Whether to display the source code. The default can be changed using the gmtplot_show_code variable in conf.py.

language{‘python’, ‘bash’}

Specify the language of the source code. The default can be changed using the highlight_language variable in conf.py.

captionstr

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_codebool

Default value for the show-code option.

gmtplot_basedirstr

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

GMTPlotDirective(name, arguments, options, ...)

The gmtplot directive implementation.

Functions

environ(env)

Temporarily set environment variables inside the context manager and fully restore previous environment afterwards.

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.