# Seplot : a simple command line (and python) plotting tool

Welcome seplot, a plotting tool to be used from the command line, or from a python script. It is a front-end for my favorite plotting program, PyX.

To install it, just use :
 $pip3 install seplot  Then you can use it to plot data stored in a text file or in a csv file ; for instance : $ seplot data.txt 
will plot the second column of file data.txt as a function of the first column.

That is equivalent to (using Python’s indexing convention starting at 0)
 $seplot data.txt x=0 y=1 out=plot.pdf  By default, seplot exports to plot.pdf, but any .pdf, .eps, or .svg filename can be specified. But one might want to do more, for example plot a function of the input data, and plot error bars : $ seplot data.txt x='sqrt(A[:,0])/2' dy='sqrt(y)' 

You can also plot according to a condition, e.g. y>0 :
 $seplot data.txt if='y>0'  And to do a bit more, specify a style according to y values : $ seplot data.txt if='y>0' color=red andif='y<=0' color=blue 

Also, seplot supports LaTeX so you can label plots like :
 $seplot data.txt y='sin(A[:,0])' title='$\sin{x}$' xlabel='$v$in$\mu m / s$'  You can also plot an arbitrary function y(x). For instance, to get the image above, the command was : $ seplot data.txt y='abs(y)' title='$\sqrt{x^2}$' style=o color=blue dy=2 function='y(x)=x' ylabel='velocity $v$ (m s$^-1$)' xlabel='time $t$ (s)' 

You can also use seplot from Python :
 import seplot plot=seplot.Splotter(xlabel='$v$') plot.add_plot(file='data.txt',cond='A[:,0]>0') plot.make_and_save(out='nice_data_plot.svg') 

For all the possibilities, see the README.

This entry was posted in Uncategorized. Bookmark the permalink.

### 3 Responses to Seplot : a simple command line (and python) plotting tool

1. Anil says:

This is cool …. Does it handle multiplots ?

• SergeDmi says:

Thanks ! What do you call multiplot, several plots on the same page à la ggplot ?
If so it doesn’t… But the backend, PyX, surely does.

It could be something to develop, although it’s so easy to script (with gz or similar tools) that for now I wouldn’t see the point 😉

• Anil says:

I agree, was just curious… I usually use gnuplot to quickly check the data file ..looks like I found an alternative 🙂