Standardized Schoeller diagrams—A Matlab plotting tool

A complete water analysis typically contains at least 65 chemical and physical parameters. This variety of parameters complicates temporal or spatial comparisons of different water samples. Hence, special hydrogeological diagrams, such as the Schoeller diagram, were developed to facilitate the evaluation and interpretation of analytical results of multiple samples. In conventional Schoeller diagrams, the concentrations of calcium, magnesium, sodium, chloride, sulfate, and bicarbonate/carbonate are plotted as points on logarithmic scales. Points of one analysis are connected to form characteristic signatures of each sample. Occasionally, resulting parallel signatures indicate a similar water genesis. Here, we present standardized Schoeller diagrams and introduce a practical Matlab tool for this purpose. Standardization means that the different logarithmic axes are shifted towards each other so that the signature of a selected sample becomes a horizontal line. This procedure greatly facilitates comparisons of water samples to the chosen standard and increases the informative value of the diagrams. However, manual implementations of standardizations are arduous and time-consuming, as a single calculation of the relocation of each axis is necessary. In addition, the calculations must be repeated if another sample is chosen as the standard. We developed a Matlab tool that allows the fast generation of standardized Schoeller diagrams with many options and implements user-specific preferences with just one command. Probably the most useful feature is that users can choose which parameters are displayed, opening up new areas of application for Schoeller diagrams.


Introduction
The analysis of water samples results in multiple variables.As the number of parameters analyzed increases, it becomes more challenging to summarize the data and to prepare it for end-users or stakeholders such as water authorities, engineering consultants, researchers or companies.Graphical representations have been developed to facilitate evaluation, comparison, and interpretation of results, ranging from simple graphics to complex diagrams, specially tailored to describe hydrogeological issues related to groundwater composition.Examples include bar or column diagrams (Collins 1923), ray diagrams (Dalmady 1927), pie or circle diagrams (Udluft 1953) or Stiff diagrams (Stiff 1951).Such diagrams are often combined with cross-sections or maps (e.g.Carlé 1964;Habermahl 2020;Schäffer et al. 2021a) to illustrate groundwater quality.
Probably the most popular diagram among hydrologists is the Piper diagram (Piper 1944), named after the US-American geochemist Arthur M. Piper (Upson 1992), who slightly modified or further developed suggestions by Hill (1942) as well as Langelier and Ludwig (1942).Durov developed a similar diagram that was used primarily in the former Soviet Union (Durov 1948;Chilingar 1956).Decisive for the position of water samples within the Piper diagram are the ratios of the equivalent concentrations of calcium, magnesium, sodium, and potassium on the one hand, and bicarbonate, carbonate, sulfate, and chloride on the other hand.In principle, the total concentration does not influence the position, because the relative chemical composition is shown.Piper diagrams are therefore suitable to classify water types (e.g.Furtak and Langguth 1967) or hydrochemical groups independently of the total concentration of samples.In addition, the Piper diagram is wellsuited to identify mixed waters if end members are known.
An excellent complement to the Piper diagram is the Schoeller diagram (Schoeller 1935), invented by the French geologist and hydrologist and Henri Schoeller (1899Schoeller ( -1988) (Langguth and Michel 1980).In this diagram, concentrations of any species are shown on a vertical, logarithmic scale, allowing to plot a wide concentration range.Since absolute concentrations are displayed instead of ratios, Schoeller diagrams are well-suited for questions where the concentration is relevant, for example, with regard to ion exchange processes, water quality, legal threshold values, groundwater genesis, or mixing of waters.The greater the difference in concentration, for example, between lowmineralized vadose waters and brines, the more meaningful a Schoeller diagram becomes.
Schoeller drew the first version with calcium, magnesium, sodium, chloride, sulfate, and carbonate displayed in equivalent concentrations (Schoeller 1938).Schoeller diagrams are versatile and can also display other species such as bicarbonate, potassium, nitrate, iron or sum parameters like total dissolved solids (TDS) or the total equivalent concentrations (TEC).Depending on the problem, any combination is possible, including physical parameters like electric conductivity, redox potential, or oxygen saturation.Some authors use equal logarithmic axis and concentrations given in equivalent concentrations (e.g.Güler et al. 2002;Nasrabadi et al. 2009), while others prefer to use shifted logarithmic axis or to show mass concentrations (e.g.Schäffer and Sass 2014;Babanezhad et al. 2018;Heldmann et al. 2020).Regardless of the chosen species and units, data points from the same sample are connected with straight lines, resulting in a hydrochemical signature that is unique to each water sample.Hydrochemical similarities or differences can be observed by comparing these signatures.Congruent signatures suggest that the water samples are from the same aquifer or have a similar origin.Parallel or subparallel signatures indicate hydrochemical relationships, such as those caused by dilution.The usefulness of Schoeller diagrams can be significantly improved through standardization, which was first presented by Schäffer et al. (2014).In a standardized Schoeller diagram, the axes of different species are individually shifted so that the signature of the standardizing sample forms a horizontal line.This simplifies comparisons of other water samples to the standard sample.This form of presentation is easy to understand and can be intuitively interpreted even by people who are not familiar with hydrogeological subjects.To the best of our knowledge, neither free software (e.g., Simler 2020; Winston 2020; R Core Team 2021), nor commercial programs like Geochemist's Workbench (Aqueous Solutions LLC 2020) can produce standardized Schoeller diagrams.However, manual drawing is time-consuming and laborious, even if graphic editors are used.An attractive software solution is necessary to encourage the creation and use of standardized Schoeller diagrams.The Matlab tool described here offers easy data import and variable generation of standardized Schoeller diagrams based on diverse requirements, preferences, or ideas.

Matlab tool
The manual generation of a standardized Schoeller diagram involves considerable effort.Firstly, commonly used data management systems cannot create multi-column logarithmic diagrams with suitable grid lines.Secondly, the data management itself, including data modification for each new plot and the handling of irregularities like missing values, values below the detection limit, or values equal to zero, is time consuming.
The developed Matlab tool solves these problems directly and is user-friendly.It requires no prior knowledge of Matlab and creates a plot with only a single command line.A minimal example of such a Matlab command is: plotSchoeller.'ExampleDataSet.xlsx',1/ The command imports the raw data from the file 'Exam-pleDataSet.xlsx',plots the first data set as a vertical line, and all other data sets relative to it.The tool automatically adjusts the coordinate system and all lines within the plot.A defined distance to the top and bottom of the plot is maintained.
The algorithm is structured in four main blocks: data import, data processing, plot setup, and plot export.The Matlab tool and detailed documentation, including a manual that describes the full potential of importing, designing and creating images, a sample .xlsxfile, and a sample file that generates the tutorial graphics, can be downloaded and used under a CC-BY license from Dietz and Schäffer (2022).
The Matlab tool imports the data from file formats such as .xlsx.csv.odsor .txt.More information is available from Matlab (2023).Thus, raw data can already be managed in these files.There are only a few restrictions associated with the Matlab import: the first two rows serve to identify and label the columns, as well as the elements of the plot.The first two columns will identify and label the legend and the data sets.The remaining cells can be designed freely.The legend and columns can be labeled in usual plain text or in TeX code, a typeset system that allows commands to style the text e.g.^{2+} for superscripts or \bf for bold text.In addition, the tool allows any number of columns for elements and any number of rows for samples, from K which either all or a selection can be plotted.A minimal example for such an excel file including TeX code is given in Table 1.
As Matlab does not have a standard tool for multi-column logarithmic plots required for standardized Schoeller diagrams, the data needs to be transformed.Let D be the matrix of the given data, where each column represents an element and each row represents a data set.Next, D i;W is defined as the i-th row, D W;j as the j-th column, and Di,j as the entry with row i and column j.The data set of the straight line is denoted as D p;W and is called the pivot data set.All other values, including the grid lines of the coordinate system, are plotted relative to the pivot data set.This means that the y-axis of each column is shifted individually up or down so that the pivot data set forms a straight line.
The Matlab code creates a new relative matrix e D and computes the entries according to Eq. 1: Thus each element of the pivot data set results in Now, the values of e D are plotted as a usual logarithmic plot.The grid lines G are plotted as graphical elements by the tool and are rearranged correspondingly: It is important to note that a data set does not need be complete to be used in this tool.Let Lj be the detection limit for column j.Respective detection limits can be defined within the tool by passing the detection limits as a parameter.In this situation, two special cases can occur: D i;j = 0 with i ¤ p, or lower than the detection limit or missing.The tool will place the point on the bottom of the diagram, and an automatic tooltip with "< L j " can appear, if desired.
D p;j = 0, or lower than the detection limit or missing.The tool will set D p;j = L j 2 and e D i;j = 2 D i;j L j and plots the detection limit divided by two to the constant line and every other value relative to it.An automatic tooltip with "< L j " can also be added, if desired.
There are, of course, other statistical techniques to handle issues including missing values, censored data and null values (Helsel 2012;Wollschläger 2020;Backhaus et al. 2021).Users can avoid the above-mentioned procedure by implementing a statistical technique of their own choice in the raw data to be used in the tool, as long as every plotted parameter contains a value.
With small modifications, the standardization can also be done for other cases.The tool will create a usual (not standardized) Schoeller diagram if a pivot line number of 0 is entered.It is also possible to create an arbitrary data set in the raw data table and to use this as the standard.For example, mean values, maxima, minima, artificial reference values, etc., can be compiled and chosen as the pivot data set.
The plot command offers numerous additional options for customization.A comprehensive list of options and some graphical examples are available in the manual (Dietz and Schäffer 2022).All options can be adjusted by simple entries in the plot command.For example, the command plotSchoeller('ExampleDataSet.xlsx',1,'.--','Markersize',15,'Color','r','LineWidth',4) creates dashed lines, equips it with markers at the data points, colors it red, and displays the lines with a thickness of 4 pixels.All commands referring to rows, such as line type, line color or line style, can be adjusted separately for each data set.All commands that refer to a column can also be adjusted for each element.

Example 1: comparison of spring waters from different tectonic units
At the northwestern edge of the Tauern Window in Tyrol, Austrian Alps, several overthrust faults occur within a few kilometres and the tectonic nappes are partly shingled and/or folded, consisting of several rock types, making the geological situation complex (Schäffer et al. 2020;2021a and citation therein).These metamorphic rocks are predominantly aquicludes.Only the Hochstegen formation, mainly consisting of calcite and dolomite marble, could act as a karst aquifer.Locally, numerous caves and other karst phenomena are known (Spötl and Mangini 2010) it was unclear whether the entire Hochstegen formation is karstified and thus functions as a connected karst aquifer.This is relevant because it could be assumed that the Tux valley would also be drained underground over a length of about 20 km and an elevation difference of more than 2000 m.
To investigate this hypothesis, springs and streams were sampled throughout the valley and assigned to rock units based on their catchment area (Sass et al. 2016;Schäffer et al. 2021a).Mean values of hydrochemical parame-ters were calculated for the respective rock units.For the Hochstegen marble, we distinguish an area in the upper valley belonging to the Wolfendorn nappe and an area in the lower valley directly enclosing the Tauern Window in a narrower sense (data in Table 2).The standardized Schoeller diagram (Fig. 1a) shows the respective mean values.The Hochstegen marble enclosing the Tauern Window was chosen as the standard because the hydrochemical relationship to this unit is to be tested.In the standardized Schoeller diagram, the signature of the Hochstegen marble of the Wolfendorn nappe appears subparallel, with the exception of chloride and sulfate, with concentrations about half an order of magnitude lower compared to the standard.The standardized Schoeller diagram indicates that meteoric water infiltrates into the Hochstegen marble within the Wolfendorn nappe in the upper valley and then flows subterraneously according to the hydraulic gradient.In this process, groundwater dissolves other minerals and accumulates dissolved solids as the flow distance increases.In addition, a mixture with water infiltrating along the flow path may also occur, resulting in a depletion of sulfate and an enrichment of chloride.Finally, the groundwater partially discharges at springs in the lower part of the valley (dark blue signature in Fig. 1).Other relationships to other rock units are not visible in the standardized Schoeller diagram.In summary, the standardized Schoeller diagram provided evidence for a large-scale and connected karstification of the Hochstegen formation.This interpretation would be much more difficult to make on the basis of a conventional Schoeller diagram (Fig. 1b), because all waters are K low mineralized Ca-HCO3-waters, which yield a cloud of points or signatures that are difficult to differentiate without standardization.

Example 2: ascent and dilution of an acidulous thermal brine
The thermal spa Bad Soden-Salmünster is located in the Mid-German Crystalline Zone in Hesse, Germany (Zeh and Will 2010).The crystalline basement is overlain by the Permian Rotliegend formation of clastic sediments (Kowalczyk and Prüfert 1974), the Permian Zechstein formation consisting mainly of carbonates and evaporites (Richter-Bernburg 1953), the Triassic Buntsandstein formation of sandstones and mudstones (Lepper et al. 2014;Dersch-Hansmann et al. 2014), and Quaternary deposits.The spa has been using acidulous thermal brine from springs and boreholes for over 175 years (Hanna 1986;Hansmann and Noll 1987).The oldest available water analysis dates back to 1877 from the Barbarbossaquelle (Himstedt et al. 1907), providing a nearly 150-year series of measurements (Schäffer et al. 2021b).Over time, springs and shallow wells have been gradually replaced by deep wells (Schäffer et al. 2018).The Pacificus-Sprudel (406 m, drilled in 1909), the Fritz-Hamm-Sprudel (503 m, drilled in 1972), and the König-Heinrich-Sprudel (539 m, drilled in 1931) (Mestwerdt 1933) are the deepest wells.The Trinksprudel is a double borehole: well 1 was drilled to 122 m in 1970, and well 2 was drilled aside to 30 m in 1971.These wells, except for the Pacificus-Sprudel, are still in operation today.
To clarify the genesis of the acidulous thermal brine, a standardized Schoeller diagram is used, with data shown in Table 2.The König-Heinrich-Sprudel well serves as the standard as it shows the highest load of dissolved solids (Fig. 2b).Additionally, Rolandquelle and the waterworks Huttengrund are plotted as representatives of the shallow groundwater.In comparison to the diagram in Fig. 1, iron is plotted instead of nitrate, as nitrate concentrations are low in the brine, while iron concentrations vary by several orders of magnitude between brine and shallow groundwater.Therefore, iron is a good indicator of mixing processes at this site.Note that iron concentrations in Rolandquelle and at the Huttengrund waterworks are below the detection limit of 0.01 mg/l.
The König-Heinrich-Sprudel and Fritz-Hamm-Sprudel samples have almost identical signatures and represent the pure, undiluted brine from the Zechstein reservoir (Fig. 2a).The Rolandquelle and the waterworks Huttengrund signatures are quite similar.Eight signatures of the analyses with a solid line between them are similar among themselves.Exceptions are magnesium in Ottoquelle 1886, potassium in Barbarossaquelle 1877, Huttenquelle, Pacificus-Sprudel, and Ottoquelle 1886, sulfate in Pacificus-Sprudel, bicar-bonate in Huttenquelle as well as iron in the Carl-Roth well 1929, and in the Barbarossaquelle 1877 and Huttenquelle springs.Based on the parallel to subparallel course of the signatures, these eight analyses are classified as a hydrochemical group, originating from the mixture of brine and groundwater from near-surface aquifer layers.Here, the solution content increases with depth and due to different aquifer levels (Schäffer et al. 2018), illustrated, for example, by the analyses of Trinksprudel wells 1 and 2 (Fig. 2a).In the standardized Schoeller diagram, a second effect is also evident from two analyses of Barbarossaquelle, Ottoquelle, and the Carl-Roth well, respectively (same color but solid and dotted lines in Fig. 2a).The signatures of the corresponding samples are similar, but the younger ones are shifted downward by one to two orders of magnitude.This indicates that there has been a uniform dilution of waters over decades.Therefore, the increasing number of deep wells has reduced or completely stopped the natural ascent of brine through the different aquifer levels to the springs at the surface, considerably decreasing the proportion of brine in the mixed water.
This detailed interpretation of groundwater genesis would be much more difficult to make with a normal Schoeller diagram (Fig. 2b).Subtle similarities and differences are difficult to notice due to a lack of standardization.The absolute concentration variability between potassium, sodium, chloride, sulfate, and iron leads to signatures with steep slopes, which additionally obscure similarities and differences.

Example 3: identification of groundwater contamination by mining waste
Evaporites of the Permian Zechstein formation have been mined for more than 100 years in the Werra Potash Region in eastern Hesse and western Thuringia, Germany (Dietz 1929).Since 1929, potash wastewater has been either injected into the Plattendolomit aquifer of the Zechstein or discharged into the Werra River (Finkenwirth 1964).Although the injected brine remains mainly in the Zechstein, it can locally ascend into the Triassic Buntsandstein formation or Quaternary deposits, where it mixes with shallow groundwater or flows into the Werra River (Sworonek et al. 1999).
Solid residues from potash mining, predominantly rock salt, are stored in waste piles.If these piles were constructed without a base seal or if the seal fails, precipitation could dissolve the salt, infiltrate the subsurface, and contaminate shallow groundwater (Siefert et al. 2006).For the first time in 2016, groundwater monitoring wells beneath the potash mining waste pile in Hattorf showed remarkable high concentrations of aluminium, cadmium, iron, lead, manganese, nickel, and zinc.Follow-up investigations were initiated to Fig. 2 Comparison of a standardized (a) and a conventional (b) Schoeller diagram to compare waters from different springs ("Quelle" in German) and wells ("Brunnen")."Sprudel" is a sparkling well that often produces brine without pumping due to gaslift.Analyses of the same spring or well are distinguished by the year of the analysis.Water analyses are given in Table 2 Abb. 2 Vergleich eines herkömmlichen (a) und standardisierten (b) Schoeller-Diagramms um Wässer verschiedener Quellen und Brunnen zu vergleichen.Analysen identischer Quellen oder Brunnen werden durch das Analysejahr unterschieden.Wasseranalysen in Tab. 2 determine whether there is a hydraulic connection to the potash mining waste pile (data in Table 2).
The Schoeller diagram in Fig. 3a is standardized on the Wolfsgraben well, one of the groundwater monitoring wells with high concentrations.Two samples from the waste pile drainage, as well as five samples from surrounding springs, are also plotted.One sample from the Werra River is plotted for comparison.As expected, the signatures of the two samples from the waste pile are almost identical.Except for potassium, the signatures of the spring waters are also quite similar among themselves.The concentrations of magnesium, potassium, sodium, chloride, sulfate, and total dissolved solids (TDS) are three to five orders of magnitude higher in the waste pile waters compared to the K spring waters.The signatures of the Werra and Wolfsgraben samples are in between and can be explained by the mixing of waste pile waters and uncontaminated groundwater (Fig. 3a).However, this is not true for calcium and bicarbonate.While calcium shows the highest concentrations in the Wolfsgraben well and is not detectable in the waste pile waters, bicarbonate concentrations are highest in the Werra River and springs and lowest in the waste pile waters, with relatively small differences compared to the other species considered.Thus, the calcium concentration in the Wolfsgraben well cannot be explained simply by mixing of these waters; other processes, such as ion exchange reactions in the aquifer, might play a role.Overall, the standardized Schoeller diagram provides evidence that the Wolfsgraben well is a mixture of groundwater and waste pile water, and thus the contamination with heavy metals is also very likely due to the waste pile water.
In addition to being easier to interpret, the standardized Schoeller diagram (Fig. 3a) has the advantage over a normal Schoeller diagram (Fig. 3b) in that fewer orders of magnitude need to be represented, making it more compact.

Conclusions
Standardized Schoeller diagrams are more meaningful and powerful than conventional Schoeller diagrams, but generating them manually can be laborious.To address this issue, we present a Matlab tool that enables the quick and easy digital production of standardized Schoeller diagrams, with many options to fulfil user-specific needs and requirements.We provide three examples that demonstrate how standardization facilitates the comparison of water samples to the chosen standard, and how it increases the informative value of a Schoeller diagram.Conclusions and interpretations derived from the standardized Schoeller diagrams cannot be obtained using conventional Schoeller diagrams.Therefore, we hope that standardized Schoeller diagrams will be helpful and beneficial to many users, and will be widely applied.

Table 1
Example minimal data set used in the manual.It already includes syntax for the import into Matlab Tab. 1 Beispielhafter minimaler Datensatz aus der Anleitung.Er enthält bereits die Syntax für den Import in Matlab . However,