News:

alphaMELTS 1.9 is available at the download and information site.
alphaMELTS 2 standalone & for MATLAB/Python are available on request
(see the Version 2 tab on the download site for more details).
For news of all MELTS software see the MELTS Facebook page.

Main Menu

Plotting tools for alphaMELTS 2 and alphaMELTS for MATLAB/Python

Started by Paula, June 27, 2021, 12:06:58 PM

Previous topic - Next topic

Paula

Work in progress

Generic Mapping Tools



It is primarily a mapping program but can also be used for x-y plots, histograms and much more. The nice thing about using GMT for plotting alphaMELTS output is is that there are standalone, MATLAB and Python versions, so you can easily generate exactly the same figures in all alphaMELTS versions with very few changes to the script. For that reason we are starting to include gmt scripts for plot generation in the alphaMELTS examples e.g. see the 'tutorial' folder included in alphaMELTS 2.1 for testing.


  • On Windows installing GMT also installs the MATLAB version (gmtmex).
  • On Mac/Linux the MATLAB version (gmtmex) must be installed separately, but the instructions on GitHub are a little out of date. What worked for me using a Homebrew installation of gmt was:
    Quote
    Run the gmt_prepmex.sh script which was located in /usr/local/Cellar/gmt/6.2.0/share/gmt/tools (obviously the version will change with time)
    Manually edit ~/.gmtversions ('~' means the user's home space, and '.' denotes a hidden file) so that it has one line /opt/gmt and another /usr/local/Cellar/gmt/6.2.0 (and no blank lines)
    Use gmtswitch to make the /opt/gmt version active
    Checkout the project with: git clone https://github.com/GenericMappingTools/gmtmex
    In the gmtmex directory, run autoconf then configure --enable-matlab
    Run make which builds the gmtmex.mexmaci64
    Copy gmtmex.mexmaci64 and gmt.m into the MELTS_Matlab/package folder
    [I missed out the bit about putting GMT_CUSTOM_LIBS=/opt/gmt/lib/gmt/plugins/supplements.so in gmt.conf as that directory was empty and it seems to work anyway...]
  • The Python version (pygmt) can be easily installed via conda or pip3

I haven't explored the GMT community contributions yet to see if there are templates for common geochemical plots like TAS. The WebPlotDigitizer is useful for extracting coordinates for all sorts of plots and plotting software.

MATLAB-based tools

There are plenty of helpful packages that can be browsed on MathWork's File Exchange. Some that I have used either the current or predecessors of include:

  • A new ternary plot package - ternary_plots
  • A package for plotting TAS charts, which is quite old but simple enough that it works in newer MATLAB versions - plotTAS
  • Not geochemistry specific, but useful for producing publication-quality figures from MATLAB - export_fig
Python-based tools

The pyrolite package is a set of tools for making the most of geochemical data in Python. It is the work of Morgan Willliams and others. The pyrolite package actually has an Extension to work with alphaMELTS 1.X (pyrolite-meltsutil), and the hope is to make it work directly with alphaMELTS for Python in future.

Excel-based tools

MELTS for Excel has a "Combine tbl" function on the Tools tab that can be used to import text files output by the Rhyolite-MELTS GUI, and automatically create tables and plots similar to those generated by full MELTS for Excel calculations. A pared-down version of MELTS_Excel contains only the 'Combine tbl' function, but can work on all versions of Excel, Windows or Mac is available on the alphaMELTS links page and is an excellent way to quickly browse the results of GUI calculations. easyMelts generates GUI-tyle output automatically, and alphaMELTS 2 and alphaMELTS for MATLAB/Python have options to generate GUI-style output files that can be imported with this tool.

If you are using Excel then check out GeoPlotters (https://www.geoplotters.com/find-a-plot) for more information and downloadable Excel templates for many standard geochemical plots. It's an excellent resource.

R-based tools

alphaMELTS for Python can be run in R using the reticulate interface. The latest alphaMELTS for MATLAB/Python (v1.1) an R version of the 'tutorial' is included for testing, and we will gradually add R versions to the other examples. To run the tutorial example you will need to make sure you have the following (plus dependencies):
Quote
install.packages("reticulate")
install.packages('ggplot2')
install.packages('reshape')

The GeoChemical Data ToolKIT, or in short GCDkit, is a system for handling and recalculation of whole-rock analyses from igneous rocks. It is written in R, and has been successfully used with alphaMELTS output (not by me personally yet). See Janoušek et al. 2006 for more details.