Simple command line plotting tool

I made a simple command line plotting tool : splot.py. It’s available on my github

To use it you should first install python PyX, a very nice plotting tool for python. PyX is great but sometimes you just want to plot something fast without editing a .py file. Use splot !

The syntax is very simple :
splot.py file.txt
splot.py file.txt ylabel='$z$'
splot.py file.txt ylabel='$z$' color=red
splot.py file.txt ylabel='$z$' color=red style=_ line=3
splot.py file.txt file2.txt file3.txt

It also uses Python’s eval() function to allow for more complex plotting. You can give x and y as a function of the numbers in A, the data stored in your text file. E.g :
splot.py file.txt x=A[:,0]/A[:,1] y='sqrt(A[:,2]/A[:,4])'

There are also shortcuts :
splot.py file.txt y=1
is equivalent to
splot.py file.txt x=0 y=1
itself equivalent to
splot.py file.txt x=A[:,0] y=[:,1]

This entry was posted in Code, Misc. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *