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.

plotXVG reads a number of arguments shown below. A number of showcase illustrations along with descriptive text files are found in plotXVG_output but can also easily be generated by running showcase_plotxvg.py. Example xvg-files both generated by GROMACS and Alexandria Chemistry Toolkit (ACT) are found in their respective folders.

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 plot in lines, add the linestyle flag along with a line argument, such as -ls solid.

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.1.0.tar.gz (52.4 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.1.0-py3-none-any.whl (37.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for plotxvg-0.1.0.tar.gz
Algorithm Hash digest
SHA256 92868d0e300217fe027516a366ad9459c3281c8834689ac7738d41a3fea14b94
MD5 42479d43072710ad321a3874d0f69217
BLAKE2b-256 5e71209c1ced933bf7268b0af36b8e455d6eebd6b4f20734d834103584651421

See more details on using hashes here.

File details

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

File metadata

  • Download URL: plotxvg-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 37.2 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3775c8565fde0fb6d335163a4b65bee85d03deaee53d06a9323faf1c701644f8
MD5 d0c9fc4c17c432121e1f2f287bc96daf
BLAKE2b-256 87fd8d8fae748ed8b1be4fe0a3ac78056a11a7a11d9955a048454664822ccda6

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