Python Gnuplot wrapper
Project description
Author: Ben Schneider
Requires:
Gnuplot
numpy
Installation:
pip install PyGnuplot
Upgrade:
pip install --upgrade PyGnuplot
Functions:
c(command)
pipe a command to gnuplot as if in gnuplot command promt
c('plot sin(x)')
s(data, filename=’tmp.dat’)
save arrays into file easily read by Gnuplot
s([X,Y,Z]) # creates tmp.dat
c('plot "tmp.dat" u 1:2')
plot(data, filename=’tmp.dat’)
Plot some data. Saves data into filename (default = ‘tmp.dat’) and then sends plot instructions to Gnuplot
plot([x,y])
figure(number=None, term=’x11’)
Create a new or update a figure
figure(1)
p(filename=’tmp.ps’, width=14, height=9, fontsize=12, term=’x11’)
Create postscript file (overwrites existing)
p('myfile.ps')
pdf(filename=’tmp.pdf’, width=14, height=9, fontsize=12, term=’x11’)
Create a pdf file (overwrites existing)
pdf('myfile.pdf') # creates 'myfile.pdf'
Setup terminal
Default terminal is ‘x11’ unless defined otherwise:
import PyGnuplot as gp
gp.default_term = 'wxt' # set wxt as default terminal (i.e. on Windows)
Examples:
1 Example code
import PyGnuplot as gp
import numpy as np
X = np.arange(10)
Y = np.sin(X/(2*np.pi))
Z = Y**2.0
gp.s([X,Y,Z])
gp.c('plot "tmp.dat" u 1:2 w lp)
gp.c('replot "tmp.dat" u 1:3' w lp)
gp.p('myfigure.ps')
2 Example file
python example.py
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
File details
Details for the file PyGnuplot-0.10.0.tar.gz
.
File metadata
- Download URL: PyGnuplot-0.10.0.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ec8fd9332e4b484a18994b67165524849c74daa9c6209ca3e1a253a35f367f78 |
|
MD5 | 598f4d0eb7fb74aa54e88ab46511b1c1 |
|
BLAKE2b-256 | 71e689f955beb04a8ed45c9305b0fde241a5074280bb40cee43c3638e5374557 |