Skip to main content

Batch-generation of publication quality graphs.

Project description

plotXVG

Molecular simulation tools such as GROMACS routinely produce time-series of energies and other observables. To turn this data into publication quality figures a user can either use a (commercial) software package with a graphical user interface, often offering fine control and high-quality output, or write their own code to make plots using a scripting language. In the age of big data and machine learning it is often necessary to generate many graphs, be able to rapidly inspect them, and to make plots for manuscripts. This repository provides plotxvg, a simple Python tool built on the well-known matplotlib plotting library that will generate publication-quality graphics from, for instance, an energy calculation. This will allow users to rapidly and reproducibly generate series of graphics files without programming. Obviously, the tool is applicable to any kind of line graph data, not just that from molecular simulations.

Pip install plotXVG to your current python environment by running

python -m pip install plotxvg  

in the command line.

To use plotXVG, simply type plotxvg -f <filename>.xvg in the command line and it will generate a plot. Default setting is a scatterplot, if you want to generate a lineplot, add the linestyle flag along with a line argument, such as -ls solid.

plotXVG reads a number of arguments shown below. Clone this repository by running

git clone https://github.com/AlexandriaChemistry/plotXVG  

and find a number of showcase illustrations along with descriptive text files found under tests/plotxvg_tests-output/ and can also easily be generated by running python test.py in the tests folder. Example xvg-files are generated by GROMACS and Alexandria Chemistry Toolkit (ACT), found in their respective folders.

plotXVG flags

options:  
  -h, --help            show this help message and exit  
  -f, --filename [FILENAME ...]  
                        Filename(s) to read and plot  
  -follow, --follow     Continuously update the plot by re-reading the input file(s)  
  -debug, --debug       Turn on printing of debugging messages  
  -font, --fontname FONTNAME  
                        Font for all text.  
  -alfs, --axislabelfontsize AXISLABELFONTSIZE  
                        Axis label font size, default 26  
  -tfs, --titlefontsize TITLEFONTSIZE  
                        Title font size, set to zero for no title, default 30  
  -lfs, --legendfontsize LEGENDFONTSIZE  
                        Legend font size, set to zero for no legend, default 26  
  -tickfs, --tickfontsize TICKFONTSIZE  
                        Tick font size, default 24  
  -ls, --linestyle LINESTYLE [LINESTYLE ...]  
                        What kind of line style: solid, dashed, dashdot, dotted  
  -mk, --marker MARKER [MARKER ...]  
                        Use markers for data sets: o, +, x, <, >...  
  -mksize, --markersize MARKERSIZE  
                        Size of filled markers for data sets, default 10  
  -mkwidth, --markeredgewidth MARKEREDGEWIDTH  
                        Size of character markers (e.g. +) for data sets, default 2  
  -colors, --colors [COLORS ...]  
                        Colors for the plots. Colors defined by the user will be applied to the datasets in order. If there are more datasets than color inputs, default colors will be used.  
  -save, --save SAVE    Save plot. Please specify saving location and preferred filetype (.pdf, .png...)  
  -sqfig, --squarefig   Make the figure square  
  -eqax, --equalaxes    Make the plot square with equally large axes  
  -bar, --bar           Make a bar graph  
  -noshow, --noshow     Do not show the figure  
  -res, --residual      Subtract x from y for all data sets - useful for correlation plots  
  -fl, --filelabel      Add the filename to the labels in the plot (may yield long labels)  
  -logy, --logy         Use a log scale on the Y-axis  
  -xmin, --xmin XMIN    Minimum value of X-axis. Default = defined by data.  
  -xmax, --xmax XMAX    Maximum value of X-axis. Default = defined by data.  
  -ymin, --ymin YMIN    Minimum value of Y-axis. Default = defined by data.  
  -ymax, --ymax YMAX    Maximum value of Y-axis. Default = defined by data.  
  -xframe, --xframe XFRAME  
                        Width of the plot 100 pixels, default 16  
  -yframe, --yframe YFRAME  
                        Height of the plot 100 pixels, default 9  
  -panels, --panels     Generate different panels to plot in, one file per panel  
  -sfx, --subfigureX SUBFIGUREX
                        X position of subfigure label when using panels. Default -0.15
  -sfy, --subfigureY SUBFIGUREY
                        Y position of subfigure label when using panels. Default 1.0
  -ign, --ignore [IGNORE ...]
                        legends of the series to ignore. Please specify the whole legend label.
  -title, --title TITLE [TITLE ...]
                        User-defined title(s)
  -dslegends, --datasetlegends [DATASETLEGENDS ...]
                        Set user-defined legends. If legends are already defined in the input file they are combined for each dataset i.e. '<user-defined legend> <pre-defined legend>'.
  -sharelabel, --sharelabel
                        Show only the x-labels on the last row of plots and the y-labels on the first column of plots (useful if all subplots share the same x- and y-labels)
  -legend_x, --legend_x LEGEND_X
                        Put the legend box horizontally on this position, default 0.02
  -legend_y, --legend_y LEGEND_Y
                        Put the legend box vertically on this position, default 0.98
  -stats, --stats       Print RMSD and R2 values of datasets (x-axis is reference data and y-axis holds the predicted values)

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

plotxvg-0.9.2.tar.gz (53.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

plotxvg-0.9.2-py3-none-any.whl (38.3 kB view details)

Uploaded Python 3

File details

Details for the file plotxvg-0.9.2.tar.gz.

File metadata

  • Download URL: plotxvg-0.9.2.tar.gz
  • Upload date:
  • Size: 53.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.19

File hashes

Hashes for plotxvg-0.9.2.tar.gz
Algorithm Hash digest
SHA256 182e7b6120f42ff343a0f1ef07d0498f4708da3cb2cb5375c19c031d03504fd1
MD5 8fcc200b2dc57dde2aa4e2889b42da34
BLAKE2b-256 2b865649fddd66efd71f74af4cb9f3f32fabe0059cf49bc1a781e58eb2df60c4

See more details on using hashes here.

File details

Details for the file plotxvg-0.9.2-py3-none-any.whl.

File metadata

  • Download URL: plotxvg-0.9.2-py3-none-any.whl
  • Upload date:
  • Size: 38.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.19

File hashes

Hashes for plotxvg-0.9.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f704899743d05fc608e02b31128803eb07327e2dfe2c03ae458274f47c941a76
MD5 b6c33e4acddbfdc1ff9c66d28f4b5c23
BLAKE2b-256 7ab28c885c75c70e865848efaf7f0e90feb7075a45e3deb55728cced5c1aa73c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page