[general]
name=Geochemistry Plotting Tools
qgisMinimumVersion=3.24
qgisMaximumVersion=4.99
description=Create spider diagrams, discrimination diagrams, custom XY and ternary plots, and REE shape coefficients for geochemical data
version=1.0.0
author=Julien Perret, Mark Jessell (Centre for Exploration Targeting, University of Western Australia)
email=julien.perret@uwa.edu.au

about=Plot geochemical data straight from QGIS point layers.
 Supports:
 - spider diagrams with a choice of normalisations,
 - REE shape coefficients (lambda0-lambda4, O'Neill 2016) written to the attribute table,
 - tectonic discrimination and rock classification diagrams,
 - mineral classification plots, petrophysics cross-plots,
 - custom XY and ternary plots built from any element, oxide or numeric field; 
 - interactive plots linked to the map: selecting points on a plot selects them on the map, and the other way round, and plot styles can be shared with the layer's symbology,
 - advanced plotting options: samples can be grouped and styled by category, sized by a field (bubble plots), and summarised with category statistics (mean, median, IQR), 
 - automatic element and oxide field recognision and conversion to common units.
 Firstly developed for the UWA EART3343 lab exercises.

tracker=https://github.com/swaxi/geochem-plots/issues
repository=https://github.com/swaxi/geochem-plots

changelog=1.0.0
     1.0.0 2026-10
       **Bug Fixes**
       * Recognise element fields named by isotope mass number (Sr88, Y89, La139, Ce140, Pr141, Nd146, 88Sr, Sr_88, Sr88_ppm ...), preferring the most abundant isotope when several are present
       * Never treat normalised, ratio, error or detection-limit fields (Sr_ChondriteNorm, La_N, Y_2SE, Nb_LOD ...) as a raw element concentration; they could previously be picked up in place of the real field and give wrong Sr/Y, sum LREE, etc.
       * Winchester & Floyd (1977) diagram now plots Zr/TiO2 with both terms in ppm (TiO2 wt pct x 10000, or Ti ppm x 1.6685 when only Ti is available); a measured TiO2 (or Ti, for Zr/Ti diagrams) field is preferred over a converted one
       * Fix Custom Ternary plots drawing data towards the wrong apexes: values for A (top), B (bottom-left) and C (bottom-right) now plot towards their own labelled apex
       * Fix chemical formulas in plot titles and axis labels (e.g. TiO2 shown with a square): formula digits (TiO2, SiO2, Na2O, Al2O3 ...) are now drawn as subscripts
       * Remove the "(both in ppm)" suffix from the Zr/Ti vs Nb/Y diagram (Pearce 1996) ratio axis label; the Zr/TiO2 vs Nb/Y diagram (Winchester & Floyd 1977) keeps a "(in ppm)" qualifier to avoid ambiguity with Ti expressed in ppm
       * Fix the automatic selected-on-top map rendering order (is_selected() ascending), which was silently not applied; it is now set as soon as a layer is chosen in the plugin and restored after any symbology change, keeping any existing rendering order as a secondary sort
       * Points selected on the map are now drawn above all unselected points on scatter-type plots, so they stay visible in densely clustered data
       * Fix selecting points (on a plot or on the map) sometimes drawing a huge, wrongly-placed copy of the selected symbols on the plot instead of a normal-sized highlight: the highlight copies weren't marked with their own transform, so Matplotlib defaulted them to one meant for data coordinates rather than for the tiny marker shape itself
       * The rubber-band selection tool no longer caches/blits its own background, avoiding a separate glitch where it could go stale and get redrawn over the plot's actual current state
       * Recognise FeOT/Fe2O3T ("total iron") fields - FeOT, FeOt, FeO*, FeOtot, FeO-tot, FeO(T), FeO(t) and the equivalent Fe2O3 forms - as FeO/Fe2O3: a dataset reporting only FeOT (no separate FeO) previously had FeO flagged as missing; a real FeO/Fe2O3 field, when also present, still takes priority over its FeOT/Fe2O3T counterpart
       * New "FeO-T"/"Fe2O3-T" entries in the Custom XY/Ternary and bubble "Size by" dropdowns, for reading the total-iron field specifically (any of the spellings above) even when a separate, non-total FeO/Fe2O3 field is also present
       * Fix the Custom XY/Ternary Num/Denom tick lists starting with an entry pre-ticked (and refusing to let it be deselected on its own) and sometimes toggling an entry just from clicking to open the list; they now start empty and only toggle an entry on a deliberate click. Num/Denom can be left blank - a blank Denom is treated as no denominator (as "1 (none)" already was), while Generate Plot now asks for the missing X/Y (or A/B/C, on Custom Ternary) fields if a Num list is left empty
       * Custom XY and Custom Ternary: rename "Show all numeric fields" to "Show all numeric fields (including data different from concentrations)"
       * Fix plots (notably the apatite Sr/Y vs sum LREE diagram) reading the wrong field for an element when the layer also holds ratio or coordinate columns: a precomputed ratio such as Sr_Y could be read as Sr and a Y_UTM coordinate as Y. Ratio/anomaly fields (Sr_Y, Sr/Y, Sm_Nd, Eu_Eu* ...) are never read as concentrations, Symbol_Fullname fields must use the element's real name, isotope fields (Sr88, Y89) take precedence over other Symbol_word fields, and the fields used for each plot are listed in the QGIS Log Messages panel
       * Custom XY and Custom Ternary: Numerator/Denominator lists are now tick lists; several ticked entries are added together (e.g. Na2O + K2O), with built-in oxides/elements and unit-suffixed layer fields converted to a common unit, and a warning when the units of the added entries can't be reconciled; the bubble Size by list works the same way on every tab (summed sizes are also exported to/imported from the map's data-defined size) and on the Spider, Discrimination and Minerals tabs lists the layer's numeric fields instead of accepting a typed field name; drop-down lists open wide enough to show every entry in full
       * Category sample counts in plot legends and the style panel now read n=x/y (x plotted out of y selected samples in the category, as samples missing a required variable are not plotted); Discrimination and Minerals legends now show these counts, and the Spider diagram title counts only samples actually drawn

       **Improvements**
       * Rename the Minerals-tab apatite scheme to "Apatite - Sr/Y vs sum LREE (La+Ce+Pr+Nd) - O'Sullivan et al. (2020)"
       * Select Samples list shows each category once (with its sample count) instead of repeating it for every sample; selecting a category selects all of its samples
       * Features selected on the QGIS map are now highlighted on every open plot (map to plot selection, as well as plot to map)
       * Style panel in the plot window can now be collapsed/expanded with a button, docked to any side of the plot window (or floated), and resized by dragging the bars between it and the plot and between its Categories and Legend sections
       * Each section of the style panel (Statistics, Style Management, Categories, Legend) can be collapsed/expanded by clicking its header
       * The options on every tab of the main plugin window are now grouped into collapsible sections, each with a drag bar to resize it (double-click to reset)
       * Layer Selection, Plot Options (the tabs) and Samples are now collapsible groups separated by two draggable bars, and the window automatically re-fits (giving spare height to the Samples list) when groups or sections are collapsed/expanded or the tab changes
       * Apply the selected-on-top layer rendering order (is_selected()) when plotting from the Spider tab as well
       * Add opt-in "Use layer symbology" option: take each category's colour, marker shape, size and label from the layer's Categorized symbology when it classifies on the selected Category field (map-unchecked categories start hidden; unstyled categories keep the default plot styling); also available as a toggle button in the plot style panel (Style Management) to restyle an open plot live (click again to restore the default styles); a data-defined symbol size on the layer fills in the tab's Bubble Size settings
       * Add "Apply to layer..." button to the plot style panel, building a Categorized symbology for the layer from the plot's category styles (with confirmation; the previous layer style is kept in the layer's style list); bubble sizing is exported as a matching data-defined symbol size
       * Add median and interquartile range (IQR) to the style panel's Statistics section, with two new checkboxes alongside Show mean +/- 2 sigma, which can be combined freely: the median is an open ring around the category's symbol (dashed trace on spider diagrams) and the IQR an unfilled box from the 25th to the 75th percentile on both axes (shaded band on spider diagrams, computed in log10 space like the mean); a new Show faded individual data checkbox (ticked by default) hides the faint points/lines behind the statistics
       * Layer Selection: the layer selected in the QGIS Layers panel is now preselected if it's suitable for the plugin, and followed while the plugin is open; the Category and Add label lists show field aliases as "alias (fieldname)" when defined
       * Custom Ternary: the three apexes can now use a Linear or Log scale (log10, or log10(1 + value) when a plotted value is below 1, as shown in the apex labels). Plot Options: Bubble Size is now the last section on every tab, and Axis Scales and Display follows the field definitions on Custom XY and Custom Ternary
       * Samples: all samples are selected by default when the layer has no QGIS selection, and the list now follows map selections by itself. Rows ticked in the list now select those samples on the map and on open plots, and the All button is a true all (it also clears any QGIS selection). New Copy Table and Copy Labels buttons copy the selected samples to the clipboard, and a Selections list with back/forward buttons recalls earlier selections, which can be saved with a name and notes (stored with the layer in the QGIS project)
       * Plots: new freehand area selection (as in Stereoplot) alongside the rectangle, now also on Spider diagrams, chosen in the Style panel's Selection section; an Add to selection option combines several zones without holding Shift. Fix a Shift-drag also toggling the nearest point and making the following click ignored
       * Custom XY and Custom Ternary: Num and Denom lists are now the same width, and a menu next to each one clears the ticked entries or saves them under a name for later use, in any project
       * Plots: new Copy PNG button in the plot window's toolbar, copying the whole plot with its markers and legends to the clipboard as a 300 dpi image. The Save... button of the plugin window is removed: plots are saved from the plot window's toolbar
       * Spider tab: new "Add lambda0-lambda4 to Layer (selected samples)" button writing the REE shape coefficients of O'Neill (2016, J. Petrology 57, 1463-1508) to the layer fields lambda0-lambda4, using the paper's CI chondrite abundances, Shannon ionic radii and orthogonal polynomials (Eu excluded; at least 6 REE including one of La-Nd and one of Er-Lu needed)

       **Dependencies & QGIS 4 (Qt6)**
       * requirements.txt now declares minimum versions only, harmonised with the GEOL-QMAPS and Stereoplot plugins (numpy>=1.21 ; matplotlib>=3.5). The previous upper caps (numpy<2.0, matplotlib<3.12) conflicted with the numpy 2.x that QGIS 3.44 and QGIS 4 ship, making qpip install an older duplicate numpy that shadows QGIS's own (which can break QGIS's GDAL bindings). The floors are the oldest versions the plugin actually needs (matplotlib 3.5 is the first with the QtAgg backend used under Qt6), so qpip never replaces the packages QGIS ships.
       * Set plugin_dependencies=qpip (as GEOL-QMAPS already does), so the QGIS Plugin Manager offers to install qpip, which installs the requirements.txt dependencies, together with the plugin.
       * The map-to-plot selection highlight now also works with matplotlib 3.5 (it used a keyword only available from matplotlib 3.6).
       * Checked QGIS 4 readiness: QGIS 4 only uses qgisMaximumVersion (4.99) to decide compatibility, and the supportsQt6 flag is obsolete (removed from QGIS core), so it stays out of metadata.txt. The unscoped Qt5-only enum fallbacks (Qt.RightDockWidgetArea, QMessageBox.Ok...) flagged by the QGIS plugin repository's Qt6 check are removed: only scoped enums are used, which work with both PyQt6 and the PyQt5 5.15 of QGIS 3. A static check of the code against PyQt6 finds no unscoped Qt enums left.

     0.0.5 2026-07
       **Dependency Harmonisation & Qt6 Fixes**
       * Declared explicit numpy/matplotlib version ranges in requirements.txt, harmonised with the GEOL-QMAPS and Stereoplot plugins (numpy>=1.26.4,<2.0 ; matplotlib>=3.7,<3.12), so installing all three on the same QGIS Python environment converges on one mutually compatible dependency set.
       * Fixed a bug where a missing matplotlib installation crashed at import time instead of degrading gracefully (an unconditional matplotlib.colors import sat outside the intended try/except guard).
       * Fixed a Qt6/QGIS4 compatibility bug: QAction is now imported with a Qt5/Qt6-safe fallback (previously imported only from QtWidgets, which raises ImportError under Qt6 since QAction moved to QtGui).
       * Added the supportsQt6=True declaration to this file, now that Qt6/QGIS4 compatibility has been verified.
       * Fixed a copy-paste error in the README that referred to this plugin as "GEOL-QMAPS" in the installation instructions.

       **New Features**
       * Add Geochemical Differentiation of Sedimentary Rocks ternary diagram (Hasterok et al. 2018, after Mason 1966), with a first-screening check for required oxide fields and a below-detection-limit (negative value) handling option
       * Add category mean +/- 2 sigma statistics overlay (all plot tabs), toggled live from the interactive style panel: shows each category's mean +/- 2 sigma with individual samples faded behind it, or replaced by a semi-transparent contour-less envelope, with adjustable background opacity and error bar/marker thickness; the mean marker follows bubble sizing when active and stays in sync with the category's colour/marker
       * Add per-category drawing (z-stack) order control to the interactive style panel
       * Add hollow/full symbol fill option (white fill, coloured outline) to the interactive style panel
       * Add interactive per-category style panel (colour, marker, size, transparency) with save/load/reset/delete templates, replacing the old style JSON file
       * Add "no category" option to plot all points with a single symbol
       * Add bubble plots: scale symbol size by a chosen field (linear, log10 or exponential scaling), available for every plot type
       * Add Filter Layer to Selected / Clear Filter buttons to turn a plot selection into a QGIS layer filter
       * Fix Ti vs Zr (Pearce & Cann 1973) diagram and add automatic ppm/ppb/wt pct/oxide unit conversion across all plots
       * Recognise many more elements and oxides in Custom XY plots
       * Add Data Preprocessing sub-tab to Custom XY for below-detection-limit (negative value) handling, with substitution options and a review/histogram tool
       * Add plot-type dropdown to the Minerals tab, ready for future classification schemes
       * Improve point label readability (white background) and stacking order (always drawn above points)
       * Various dock panel usability fixes: horizontal scrolling, tabs resize to content, tighter control alignment
   
    0.0.4 
       * Allow selection of plotted points to update map selections
       * Assign field labels to points
       * Add labels to selected points in plots   
       * Allow symbol choices to be saved to and read from file 
       * Add popup label when cursor near a point   
       * Selected points plot ontop on map layer   
       * Custom triangle plot added   
       * Add Sullivan 2020 Apatite classification  
       * Add density vs magnetic susceptibility plot    
   
    0.0.3 
       * Add Winchester & Floyd 1977 plot
       * Allow any numeric field for Custom xy plots
       * Allow field names with Na_Sodium naming convention
   
    0.0.2 
       * Fix QT6 issues for QGIS 4
 
    0.0.1 - Initial release
       * Spider diagrams with multiple normalization options
       * 7 discrimination diagrams
       * Custom XY plotting with REE normalization

tags=geochemistry,geology,petrology,mineralogy,petrophysics,plot,spider diagram,discrimination diagram,classification diagram,ternary diagram,REE,REE shape coefficients,lambda

homepage=https://github.com/swaxi/geochem-plots
category=Analysis
icon=icon.svg
experimental=False
deprecated=False
plugin_dependencies=qpip
