Package: seplot
About seplotseplot is a frontend for PyX to create plot from text files in command line or through a python interface.
Developed by Serge Dmitrieff.https://www.biophysics.frInstallationInstalling with pip3 (recommended)$pip3installseplotRequired packagesseplot requires PyX, Numpy, pandas, and sio_tools. They will be downloaded when installed with pip3.UsageBasic usageseplot is meant to be used from command line or from a python script. The typical command line instruction to plot from a file data.txt would be :$seplotdata.txtBy omitting further instructions, it is implied that the data in data.txt is a set of vertical columns, and we plot column 1 as a function of column 0. seplot uses Python's zero-indexing convention (column 0 is the first column). This could also be written :$seplotdata.txtmode=vx=__0__y=__1__out=plot.pdfWheremodeisv(vertical) for columns of data andhfor rows (horizontal), and plot.pdf is the output file.When using a.csvfile, or a.txtfile with a header, we can use directly the column names :$seplotdata.txtx=timey=distanceWheredata.txtlooks like :# time distance 
0 1.0
1 2.0
...For a csv file :$seplotdata.csvx=timey=distanceWheredata.csvlooks like :,time,distance
,0,1.0
,1,2.0
...Of course several files can be plotted with different colors :$seplotdata_1.txtcolor=reddata_2.txtcolor=blueWe can also plot several columns from the same file, use columns for errorbars dx and dy, and plot a function :$seplotdata_1.txtx=__0__dx=__1__y=__2__dy=__3__color=__4__size=__5__function='y(x)=x'Here, we even used data to assign a size and color to the plot symbols ! Note that seplot can easily be used from inside a python script :importseplot.seplotasspplot=sp.Splotter(file='data.txt')# alternatively, with A an array containing the dataplot.add_plot(data=A)plot.make_and_save()This readme focuses on the command-line interface, but all instructions can also be used equally easily through the python interface.Ploting with several styles$seplotdata.txtx=__0__y=__1__dy=__2__andx=__0__y=__1__line=1Does a scatter plot of the second column as a function of the first, using the third column for error bars. Then does a line plot of the secund column as a function of the first.Histograms$seplotdata.txty=__0__-histDoes a histogram of values of the first column (y=0) of data.txt$seplotdata.txt-histx=10y=__0__style=bdata.txt-histx='[0,1,2,3,4]'style=BDoes a histogram of the first column (y= __0 __) of data.txt, with 10 bins (x=10) and then with bins centered around 0,1,2,3,4 (and filled bars : style=B)Data manipulation and conditional expressionsWe can perform operations on the input data. For a csv file, or a text file with header, we can use directly the column names as if it was the values :$seplotdata.csvy='distance*distance'Any python/numpy operation on the data is permitted. If the data is not directly named (text file without header), it is still possible to perform operation on the data.Data read from the data file (eg. data.txt) is stored in a numpy array calledA. We can apply any numpy function onAinseplotthrough a simple syntax :$seplotdata.txty='A[:,1]^2'HereA[:,1]is thesecondcolumn ofA.We can use the same syntax for conditional expressions using the keywordif:$seplotdata.txty='distance*distance'if='y>1'We can now combine several features :$seplotdata.txty='distance*distance'if='y>1'color=blueandcolor=redif='y<1'We used theandkeyword to re-use the data fromdata.txtinto another plot element (note that the shorthandandif=... is also supported).We can easily compute and plot complex functions of the input data :$seplotdata.txty='sqrt(distance*distance)/time'color='sin(time)'Similarly, theifkeyword can be used for any function of the input data :$seplotdata.txty='A[:,1]^2'if='sqrt(A[:,1])>10'Additionally, one can  select a sub-set of the data, both byfirstchoosing a range of lines (resp. columns in horizontal mode), andseconda conditional expression, e.g. :$seplotdata.txtrange='0:10'if='A[:,1]>0'Here data from the first 10 lines (lines 0-9 according to Python's numbering convention) if the value of the second columns (A[:,1]) is larger than 0.Styles and propagationseplot allows for a wide variety of symbol and line styles and attributes. Some have shorthands, but any style from PyX can be used. For instance let us plot the same data as red dots, a blue solid line, and a thick black dashed line.$seplotdata.txtcolor=redstyle=oandcolor=bluestyle=_andcolor=blackstyle=--line=4Other symbols include "+" (vertical cross), "x" (cross), ">" or "<" (triangle), but any of PyX'sgraph.style.symbolcan be used.When using color-by-value, any of PyX's gradients can be used, and some have shorthands :$seplotdata.txtcolor=__2__gradient=jetandgradient=grayTo keep the same style between two files, and change style for another file, we can use the-keepand-discardkeywords :$seplotdata_0.txtcolor=red-keep'data_1.txt'-discard'data_2.txt'Note than-keepand-discardkeep or discard any option, includingy=,range=,if=, etc.Labels and titlesOne of the main interest on using PyX as a backend is to have fullLaTeXcompatibility. Therefore we can happily write :$seplotdata.txtxlabel='time ($s$)'ylabel='$v$ ($m s^{-1}$)'seplot also can read directly the label from a text file using the keyword-autolabel. For example for a file with a simple header  # time position}:$catdata.txt# time position01122334We can use the instruction :$seplotdata.txt-autolabelWhich will yieldxlabel=timeandylabel=position.We can also specify the position of the graph legend, e.g. withkey=tlfor the top left :$seplotdata.txt-autolabelkey=tlCalling seplot from PythonCalling seplot from a Python script offers many possibility, including appending progressively plots during analysis, etc.importseplot.seplotasspplot=sp.Splotter(key='tl')fori,Ainenumerate(list_of_data):# A is an element of list_of_data# i is its indexplot.add_plot(data=A,title=i)plot.make_and_save()Global options are passed when callingseplot.Splotterand local options are passed when callingplot.add_plot, following the same syntax as the command line. One exception,if=(from command line) becomescond=to avoid confusion.importseplot.seplotasspplot=sp.Splotter(key='tl')plot.add_plot(file='data.txt',cond='A[:,0]>0')plot.make_and_save()Detailed option listGlobal optionsxlabel=: label of x axisylabel=: label of y axiswidth=: width of figureheight=: height of figurexmin=: min x valuexmax=: max x valueymin=: min y valueymax=: max y valuekey=: position of figure legend (tr,br,tl,bl)out=: name of output file-ylog: y axis is logarithmic-xlog: x axis is logarithmic-keep: keep options for subsequent plots, until -discard-discard: discard options for next plot-equal: equal x-y axis range-autolabels: tries to automatically find labels from data fileLocal options (per plot)x=: index of column or row to be used as x axis values (e.g. x=0 for the first column)also can specify an operation : x='A[:,0]A[:,1]'also can specify a label read from file header : x=first_column_labelcan also be automatic, i.e. index : x=autoy=: index of column or row to be used as y axis values (e.g. x=0 for the first column)also can specify an operation : y='A[:,1]A[:,2]/A[:,3]'dy=: index of column or row to be used as dy values (e.g. x=0 for the first column)also can specify an operation : dy='A[:,2]/sqrt(A[:,3])'mode=: h for horizontal (rows), v for vertical (column) (default)  when reading datacolor=: color of lines or symbol ; can be either red, green, blue, dark, medium, light, blackor color.cmyk.or color.rgb.,
or an operation, e.g. color=A[:,2]and=: add another graph (possibly with different options)style=: style of plot : - or _ for a line, -- for dashed, .- for dashdottedo for circles  x , * for crosses  + for plus   > , <     for triangles
b for a bar graph, B for a filled bar graphif= / cond=: condition to keep the rows or columnsandif=:  add another graph with different conditionsrange=: range of rows / columns to plotsize=: size of symbol usedline=: thickness of line, from 0 to 5title= / legend=: title of the graph-hist: makes a histogram