Package: xcsv-plot
xcsv-plotxcsv-plot is a subpackage ofxcsv.  It's main purpose is to provide a simple CLI for plotting extended CSV (XCSV) files.InstallThe package can be installed from PyPI:$pipinstallxcsv-plotUsing the packageXCSV data can be plotted directly, as the data table is apandastable:content.data.plot(x='time (year) [a]',y='depth (m)')and of course for more control over the plot, the data can be plotted usingmatplotlib, say.But an XCSV file with anACDD-compliantextended header section, and well-annotated column-headers, already provides much of the text needed to make an informative plot, so we can just plot the XCSV file directly from the command line.  This is the purpose of thexcsv-plotsubpackage.  For example:$python3-mxcsv.plot-x0-y1example.csvNote here that we're callingxcsv-plotas amodule main.  As a convenience, this invocation is wrapped as a console script when installing the package, hence the following invocation is equivalent:$xcsv_plot-x0-y1example.csvIn addition to using the CLI, the package can be used as a Python library.  The main class isPlotwhich provides methods to plot a given list of datasets (XCSV objects):importxcsvimportxcsv.plotasxpfilenames=['example1.csv','example2.csv','example3.csv']datasets=[]forfilenameinfilenames:withxcsv.File(filename)asf:datasets.append(f.read())plotter=xp.Plot()plotter.plot_datasets(datasets,xidx=0,yidx=1)Command line usageCalling the script with the--helpoption will show the following usage:$python3-mxcsv.plot--help
usage:xcsv_plot[-h][-xXIDX|-XXCOL][-yYIDX|-YYCOL][--x-labelXLABEL][--y-labelYLABEL][--invert-x-axis][--invert-y-axis][--titleTITLE][--captionCAPTION][--label-keyLABEL_KEY][-sFIGSIZEFIGSIZE][-bBG_IMG_PATH][-oOUT_FILE][-PPLOT_OPTS][-S][-V]in_file[in_file...]plotthegivenXCSVfiles

positionalarguments:in_fileinputXCSVfile(s)optionalarguments:-h,--helpshowthishelpmessageandexit-xXIDX,--x-idxXIDXcolumnindex(zero-based)containingvaluesforthex-axis-XXCOL,--x-columnXCOLcolumnlabelcontainingvaluesforthex-axis-yYIDX,--y-idxYIDXcolumnindex(zero-based)containingvaluesforthey-axis-YYCOL,--y-columnYCOLcolumnlabelcontainingvaluesforthey-axis--x-labelXLABELtexttobeusedfortheplotx-axislabel--y-labelYLABELtexttobeusedfortheploty-axislabel--invert-x-axisinvertthex-axis--invert-y-axisinvertthey-axis--titleTITLEtexttobeusedfortheplottitle--captionCAPTIONtexttobeusedfortheplotcaption--label-keyLABEL_KEYkeyoftheheaderitemintheextendedheadersectionwhosevaluewillbeusedfortheplotlegendlabel-sFIGSIZEFIGSIZE,--figsizeFIGSIZEFIGSIZEsizeofthefigure(widthheight)-bBG_IMG_PATH,--background-imageBG_IMG_PATHpathtoanimagetoshowinthebackgroundoftheplot-oOUT_FILE,--out-fileOUT_FILEoutputplotfile-PPLOT_OPTS,--plot-optionsPLOT_OPTSoptionsfortheplot,specifiedasasimpleJSONobject-S,--scatter-plotsetplotoptions(see-P)toproduceascatterplot-V,--versionshowprogram'sversionnumberandexitExamples

GivenanXCSVfilewithanACDD-compliantextendedheadersection,andasinglecolumn(atcolumn0)ofdatavalues:# id: 1# title: The titledepth(m)0.5751.1252.225

Thenthefollowinginvocationwillplottheonlycolumnonthey-axis,withthex-axistheindicesofthedatapoints:

python3-mxcsv.plotinput.csv

Ifthefilealsocontainsasuitablevariableforthex-axis:# id: 1# title: The titletime(year)[a],depth(m)2012,0.5752011,1.1252010,2.225thenthecolumnstobeusedforthex-andy-axescanbespecifiedthus:

python3-mxcsv.plot-x0-y1input.csv