Skip to main content

autogpy: - automatic generation of gnuplot figures from python, including scripts and data.

Project description

autogpy -

Automatic generation of gnuplot figures/scripts/data from python.

Author: Alessandro Corbetta, 2019-2020
Examples Link
Github Link

PyPI build status DownloadsPyPI - Downloads

Which problem does it solve?

autogpy eliminates annoying duplications of code and data when employing python for data analysis and gnuplot for figures. Providing a gnuplot-like or a matplotlib-like syntax, autogpy automatically generates gnuplot scripts and dumps suitably the data.


Links: [Source] [Output]

Main features

  • anything that be obtained by the gnuplot command plot can be produced
  • output figures are shipped in a folder which includes scripts, data and makefile
  • any gnuplot state modification can be achieved
  • terminals epslatex, tikz/pgfplot and jpg
  • multiplots
  • plt.hist-like gnuplot histogram figures generator
  • jupyter notebook figure preview
  • jupyter notebook gnuplot script inspection
  • easy scp-based synchronization between a machine in which the figures are generated (e.g. from even larger datasets) and the "paper writing" machine.


  • Linux/MacOs (could work on Windows, yet it has not been adjusted for)
  • Python 3
  • Working latex distribution
  • Gnuplot, optionally with tikz terminal
  • pdftoppm (via poppler-utils) or imagemagick to convert the output pdf figures in png format for jupyter notebook preview

Getting autogpy

Via pip

pip install autogpy

On Google Colab

!apt install gnuplot texlive poppler-utils ghostscript texlive-latex-extra
!pip install autogpy

From source

git clone
pip install autogpy/

In a nutshell

Please see also the examples and the documentation.

import autogpy
import numpy as np

xx = np.linspace(0,6,100)
yy = np.sin(xx)
zz = np.cos(xx)

with autogpy.AutogpyFigure("test_figure") as figure: 

	# gnuplot-like syntax
	figure.plot(r'with lines t "sin"',xx,yy)
	# matplotlib-like syntax

generates the following figure (also appearing in jupyter)

example figure

Most importantly, the following source and data are created in the folder test_figure

$ ls test_figure


With make one can obtain jpg, epslatex, and tikz/pgfplot versions of the figure. Notice that the input data has been formatted automatically and dumped in the .dat files.

Inspecting the fig__.pdflatex.gnu, responsible of the epslatex version of the figure, one gets:

set terminal epslatex size 9.9cm, color colortext standalone      'phv,12 '  linewidth 2
set output 'fig.latex.nice/plot_out.tex'

p "fig__0__.dat" with lines t "sin",\
"fig__1__.dat" u 1:2 with lines t "cos" 


  • Certain features require imagemagick and a working gnuplot-tikz.lua. Some versions of these might have bugs. Call figure.display_fixes() to show known fixes.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

autogpy-0.3.2.tar.gz (22.4 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page