Skip to main content

Python bindings for PGPLOT

Project description

ppgplot

ppgplot - The Pythonic interface to PGPLOT, with support for both PGPLOT and Giza backends.

ppgplot is a python module (extension) providing bindings to the PGPLOT graphics library. PGPLOT is a scientific visualization (graphics) library written in Fortran by T. J. Pearson. C bindings for PGPLOT are also available. ppgplot makes the library usable by Python programs. It had support for the Numeric / numarray modules, but nowadays (>= Feb 2025) replaced by Numpy, to efficiently represent and manipulate vectors and matrices.

Installing

Since v1.5 (Apr 2025) the package should be pip-installable; it's a package on the PyPI:

    $> pip install python-pgplot
    $> python3
    >>> import ppgplot
    >>>

NOTE: Due to a package name collision, the PyPI project name is python-pgplot; the obvious package name was already claimed by something completely different

It is also possible to build the package from this git-repository. You may need to create a Python venv first. See below for detailed instructions.

    $> pip install [-e] .

Note: there is a separate old-python-3.6 branch based off master, with a how-to in the commit log(s). Of course nothing works out of the box on that system - only succeeded using an (old) Anaconda3.6 base package. YMMV.

Requirements

  • Python 3.7+
  • numpy >= 1.21.0
  • PGPLOT or Giza libraries installed
  • X11 development libraries
  • pkg-config

Installing the dependencies

On Linux use your favourite package manager, e.g.:

$> sudo apt-get install giza-dev libx11-dev pkg-config

Successful installation using Homebrew on Mac OSX with:

$> brew install libx11 giza pkgconf

Installation

In principle, this extension should build out-of-the-box in a Python venv, or, if you have it, a conda virtual environment (untested at the moment). The pyproject.toml file lists all dependencies and should (...) pull them into the venv as required for building/deploying:

$> cd /path/to/checkout/of/this/repo
$> pip install [-e] .

Without -e installs the extension in the venv, with the -e keeps the module in the current directory.

Using a bespoke PGPLOT or Giza backend

The extension configuration allows compiling + linking to a locally compiled PGPLOT or Giza library.

Obviously, first install or build PGPLOT and/or Giza on your system (should you want to compare them). Then build the extension, pointing the PGPLOT_DIR environment variable to the installation directory of the backend of choice:

$> PGPLOT_DIR=/path/to/pgplot pip install [-e] . 

Notes

FORTRAN? Srsly? Actually, for plotting large numbers of points or simple, yet precise control of the graphics, the FORTRAN based PGPLOT backend is convenient and fast (a lot faster than matplotlib, and still noticeably faster than Giza). However, the upside of investing those compute cycles is that the (anti-aliased!) fonts and graphics produced by the cairo library (the actual graphics backend used by Giza) are of an amazing quality.

If ppgplot is linked against the Giza library, it can produce output in .png and .pdf, also not something to be sneezed at.

All in all, the Giza backend is an amazing job done, but it is not 100% compatible with the original PGPLOT, so it is not guaranteed your plots will come out identical.

This fork of the Python-extension owes a lot of thanks to the original author, Nick Patavlis, of ppgplot: https://github.com/npat-efault/ppgplot

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

python_pgplot-1.5.0b0.tar.gz (28.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

python_pgplot-1.5.0b0-cp313-cp313-macosx_14_0_arm64.whl (33.0 kB view details)

Uploaded CPython 3.13macOS 14.0+ ARM64

File details

Details for the file python_pgplot-1.5.0b0.tar.gz.

File metadata

  • Download URL: python_pgplot-1.5.0b0.tar.gz
  • Upload date:
  • Size: 28.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for python_pgplot-1.5.0b0.tar.gz
Algorithm Hash digest
SHA256 8e299525d185167d399cfe9b9e8e00dbb7964a001af75039bb93fdc8a5acb39e
MD5 7f5718afbd26678bc9ae0e74acc6f7b7
BLAKE2b-256 15f5da1d3d49c8c64f15c479d005861f52f9c3b931a24d345aaacb19c8ef6ccc

See more details on using hashes here.

File details

Details for the file python_pgplot-1.5.0b0-cp313-cp313-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for python_pgplot-1.5.0b0-cp313-cp313-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 a911c9befb4538eb30bbfba4d8133990dd9129e9c73704a53bae6e61b84a01df
MD5 72b995590c7bc1cca003e437f8f87a31
BLAKE2b-256 763256c7cbbc8b3d225187ac7a83cc4fd160c18d8cc8e5d6f7bd3b1665117908

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page