sphinx-contrib / gnuplot /

Filename Size Date modified Message
1.4 KB
49 B
2.2 KB
81 B
1.1 KB

Gnuplot extension for Sphinx

Author: Vadim Gubergrits <vadim.gubergrits@gmail.com>


This extensions allows rendering of plots using the gnuplot language.

This extensions adds the gnuplot directive that will replace the gnuplot commands with the image of the plot.

Quick Example

This source:

.. gnuplot::
    :title: The sine function

    plot sin(x)

is rendered as:


Gnuplot should be installed and be in the system's path.

Installing from sphinx-contrib checkout

Checkout sphinx-contrib:

$ hg clone https://bitbucket.org/birkenfeld/sphinx-contrib/

Change into the gnuplot directory:

$ cd sphinx-contrib/gnuplot

Install the module:

$ python setup.py install

Enabling the extension in Sphinx

Just add sphinxcontrib.gnuplot to the list of extensions in the conf.py file. For example:

extensions = ['sphinxcontrib.gnuplot']



size: X,Y
Width and height of the resulting plot.
title: <TITLE>
set the plot title to TITLE. Equivalent to "set title TITLE".


For now one optional configuration is added to Sphinx. It can be set in conf.py file:

gnuplot_fromat <dict>:

image format used for the different builders. latex and html fromats are supported.

For example:

gnuplot_format = dict(latex='pdf', html='png')

These are the actual defaults.

Plotting data files

Gnuplot is instructed to change its working directory to the document base directory. When referencing data files in gnuplot they must be relative to the document.

To provide a link to the data source you can use Sphinx standard download role:

.. gnuplot::

   plot 'data.dat' using 1:2

The source is :download:`here <data.dat>`.
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.