From b294f1139bf5ea83a7d17d9c6d5bfc447652f188 Mon Sep 17 00:00:00 2001 From: NicolasPietteLauziere <73743596+NicolasPietteLauziere@users.noreply.github.com> Date: Thu, 17 Jun 2021 14:24:20 -0700 Subject: [PATCH 1/4] AIOCG plots Added AIOCG plotting capabilities --- pyrolite/data/models/AIOCG/config.json | 1 + pyrolite/geochem/alteration.py | 23 +++++ pyrolite/plot/templates/AIOCG.py | 61 ++++++++++++ pyrolite/util/classification.py | 104 ++++++++++++++++++++ test/geochem/geochem_alteration.py | 14 +++ test/plot/templates/plot_templates_AIOCG.py | 26 +++++ 6 files changed, 229 insertions(+) create mode 100644 pyrolite/data/models/AIOCG/config.json create mode 100644 pyrolite/plot/templates/AIOCG.py create mode 100644 test/plot/templates/plot_templates_AIOCG.py diff --git a/pyrolite/data/models/AIOCG/config.json b/pyrolite/data/models/AIOCG/config.json new file mode 100644 index 00000000..643c8bfc --- /dev/null +++ b/pyrolite/data/models/AIOCG/config.json @@ -0,0 +1 @@ +{"name":"AIOCG","axes":{"x":"(2Ca+5Fe+2Mn)+(2Ca+5Fe+2Mn+Mg+Si) molar","y":"K/(K+Na+0.5Ca) molar"},"fields":{"K":{"name":["K"],"poly":[[0,405.2],[103.2,405.2],[109.4,244.1],[51.6,235.0],[39.6,222.8],[45.6,194.4],[0,194.4]]},"KintNa":{"name":[""],"poly":[[0,194.4],[0,121.5],[145.7,121.5],[54.7,176.2],[45.6,194.4]]},"Na":{"name":["K"],"poly":[[0,121.5],[145.7,121.5],[145.7,32.4],[157.9,0.0],[0,0.0]]},"NotAltered1":{"name":[""],"poly":[[291.6,145.9],[221.7,72.5],[294.7,30.5],[346.3,44.6],[352.3,54.7],[346.3,73.0],[334.1,101.3],[315.8,117.6]]},"NotAltered2":{"name":[""],"poly":[[291.6,145.9],[221.7,72.5],[294.7,30.5],[346.3,44.6],[352.3,54.7],[346.3,73.0],[334.1,101.3],[315.8,117.6]]},"Na-Ca-Fe-(Mg)":{"name":["Na-Ca-Fe-(Mg)"],"poly":[[145.7,121.5],[145.7,32.4],[157.9,0.0],[413,0.0],[400.8,48.7],[367.4,77.1],[352.3,117.6],[315.8,117.6],[334.1,101.3],[346.3,73.0],[352.3,54.7],[346.3,44.6],[294.7,30.5],[206.6,81.1]]},"KintK-Fe":{"name":[""],"poly":[[103.2,405.2],[109.4,244.1],[115.4,245.1],[197.5,223.5],[200.4,275.6],[194.4,405.2]]},"K-Fe":{"name":["K-Fe"],"poly":[[194.4,405.2],[200.4,275.6],[197.5,223.5],[200.4,222.8],[437.2,222.8],[431.2,328.1],[413,364.6],[413,405.2]]},"Ca-K-Fe":{"name":["Ca-K-Fe"],"poly":[[200.4,222.8],[291.6,145.9],[315.8,117.6],[352.3,117.6],[443.5,117.6],[437.2,222.8]]},"Ca-Fe-(Mg)":{"name":["Ca-Fe-(Mg)"],"poly":[[352.3,117.6],[367.4,77.1],[400.8,48.7],[413,0.0],[461.7,0.0],[445.4,70.8],[443.5,117.6]]},"Fe-rich_Ca-Fe":{"name":["Fe-rich Ca-Fe"],"poly":[[443.5,117.6],[445.4,70.8],[461.7,0.0],[607.4,0.0],[607.4,117.6]]},"Fe-rich_Ca-K-Fe":{"name":["Fe-rich Ca-K-Fe"],"poly":[[437.2,222.8],[443.5,117.6],[607.4,117.6],[607.4,222.8]]},"Fe-rich_K-Fe":{"name":["Fe-rich K-Fe"],"poly":[[413,405.2],[413,364.6],[431.2,328.1],[437.2,222.8],[607.4,222.8],[607.4,405.2]]}}} diff --git a/pyrolite/geochem/alteration.py b/pyrolite/geochem/alteration.py index 324e5a54..6f2026f3 100644 --- a/pyrolite/geochem/alteration.py +++ b/pyrolite/geochem/alteration.py @@ -127,3 +127,26 @@ def WIP(df: pd.DataFrame): """ return 2 * df.Na2O / 0.35 + df.MgO / 0.9 + 2 * df.K2O / 0.25 + df.CaO / 0.7 + +def AIOCG_xy(df: pd.DataFrame): + """ + + Alteration diagram coordinates for iron oxide-copper-gold mineralisation + system. (molecular) [#ref_1]_ + Returns X,Y coordinates to plot in discriminant diagram scaled to the + 400x600 dimension of the background + + References + ---------- + .. [#ref_1] Montreuil J F, Corriveau L, Grunsky E C (2013). Compositional + data analysis of hydrothermal alteration in IOCG systems, Great + Bear magmatic zone, Canada: to each alteration type its own + geochemical signature. Geochemistry: Exploration, Environment, + Analysis 13:229-247. + doi:``__ + """ + x = (2*df.Ca+5*df.Fe+2*df.Mn)/(2*df.Ca+5*df.Fe+2*df.Mn+df.Mg+df.Si)*600 + y = df.K/(df.K+df.Na+0.5*df.Ca)*400 + return x, y + + diff --git a/pyrolite/plot/templates/AIOCG.py b/pyrolite/plot/templates/AIOCG.py new file mode 100644 index 00000000..ad7a91d2 --- /dev/null +++ b/pyrolite/plot/templates/AIOCG.py @@ -0,0 +1,61 @@ +import matplotlib.pyplot as plt +import numpy as np +from ...util.plot.axes import init_axes +from ...util.classification import AIOCG as AIOCGclassifier +from ...util.meta import sphinx_doi_link, update_docstring_references, subkwargs +from ...util.log import Handle + +logger = Handle(__name__) + + +@update_docstring_references +def AIOCG(ax=None, relim=True, color="k", **kwargs): + """ + Adds the AIOCG diagram from Montreuil et al. (2013) [#ref_1]_ to an axes. + NOTE to user: + x:y are scaled from 1:1 to 600:400 to account for plot dimension + + + Parameters + ---------- + ax : :class:`matplotlib.axes.Axes` + Axes to add the template on to. + relim : :class:`bool` + Whether to relimit axes to fit the built in ranges for this diagram. + color : :class:`str` + Line color for the diagram. + + Returns + ------- + ax : :class:`matplotlib.axes.Axes` + + References + ----------- + .. [#ref_1] Montreuil J F, Corriveau L, and Potter E G (2015). Formation of + albitite-hosted uranium within IOCG systems: the Southern Breccia, + Great Bear magmatic zone, Northwest Territories, Canada. + Mineralium Deposita, 50:293-325. + doi:``__ + """ + AIOCG_xlim, AIOCG_ylim = (0, 607.4), (0, 405.2) + if ax is None: + xlim, ylim = AIOCG_xlim, AIOCG_ylim + else: + # if the axes limits are not defaults, update to reflect the axes + ax_defaults = (0, 1) + ax_xlim, ax_ylim = ax.get_xlim(), ax.get_ylim() + xlim, ylim = ( + [ax_xlim, AIOCG_xlim][np.allclose(ax_xlim, ax_defaults)], + [ax_ylim, AIOCG_ylim][np.allclose(ax_ylim, ax_defaults)], + ) + ax = init_axes(ax=ax, **kwargs) + + aiocg = AIOCGclassifier() + aiocg.add_to_axes(ax=ax, **kwargs) + if relim: + ax.set_xlim(xlim) + ax.set_ylim(ylim) + return ax + + +AIOCG.__doc__ = AIOCG.__doc__.format(Montreuil2013=sphinx_doi_link("10.1007/s00126-014-0530-7")) diff --git a/pyrolite/util/classification.py b/pyrolite/util/classification.py index d69e43c8..758656ae 100644 --- a/pyrolite/util/classification.py +++ b/pyrolite/util/classification.py @@ -289,6 +289,110 @@ def add_to_axes(self, ax=None, fill=False, axes_scale=100.0, labels=None, **kwar ax.set_xlabel("$SiO_2$") return ax +class AIOCG(PolygonClassifier): + """ + AIOCG Diagram classifier from Montreuil et al. (2013) [#ref_1]_. + + Parameters + ----------- + name : :class:`str` + A name for the classifier model. + axes : :class:`list` | :class:`tuple` + Names of the axes corresponding to the polygon coordinates. + fields : :class:`dict` + Dictionary describing indiviudal polygons, with identifiers as keys and + dictionaries containing 'name' and 'fields' items. + scale : :class:`float` + Default maximum scale for the axes. Typically 100 (wt%) or 1 (fractional). + xlim : :class:`tuple` + Default x-limits for this classifier for plotting. + ylim : :class:`tuple` + Default y-limits for this classifier for plotting. + + References + ----------- + .. [#ref_1] Montreuil J F, Corriveau L, and Potter E G (2015). Formation of + albitite-hosted uranium within IOCG systems: the Southern Breccia, + Great Bear magmatic zone, Northwest Territories, Canada. + Mineralium Deposita, 50:293-325. + doi:``__ + """ + + @update_docstring_references + def __init__(self, **kwargs): + src = pyrolite_datafolder(subfolder="models") / "AIOCG" / "config.json" + + with open(src, "r") as f: + config = json.load(f) + kw = dict(scale=100.0, xlim=[0, 607.4], ylim=[0, 405.2]) + kw.update(kwargs) + poly_config = {**config, **kw} + super().__init__(**poly_config) + + def add_to_axes(self, ax=None, fill=False, axes_scale=100.0, labels=None, **kwargs): + """ + Add the AIOCG fields from the classifier to an axis. + + Parameters + ---------- + ax : :class:`matplotlib.axes.Axes` + Axis to add the polygons to. + fill : :class:`bool` + Whether to fill the polygons. + axes_scale : :class:`float` + Maximum scale for the axes. Typically 100 (for wt%) or 1 (fractional). + labels : :class:`str` + Which labels to add to the polygons (e.g. for TAS, 'volcanic', 'intrusive' + or the field 'ID'). + + Returns + -------- + ax : :class:`matplotlib.axes.Axes` + """ + # use and override the default add_to_axes + ax = self._add_polygons_to_axes( + ax=ax, fill=fill, axes_scale=axes_scale, **kwargs + ) + rescale_by = 1.0 + if axes_scale is not None: # rescale polygons to fit ax + if not np.isclose(self.default_scale, axes_scale): + rescale_by = axes_scale / self.default_scale + if labels is not None: + for k, cfg in self.fields.items(): + if cfg["poly"]: + verts = np.array(cfg["poly"]) * rescale_by + x, y = get_centroid(matplotlib.patches.Polygon(verts)) + label = cfg["name"][0] + ax.annotate( + "\n".join(label.split()), + xy=(x, y), + ha="center", + va="center", + **subkwargs(kwargs, ax.annotate, matplotlib.text.Text) + ) + + + # if cfg["poly"]: + # verts = np.array(cfg["poly"]) * rescale_by + # x, y = get_centroid(matplotlib.patches.Polygon(verts)) + # if "volc" in labels: # use the volcanic name + # label = cfg["name"][0] + # elif "intr" in labels: # use the intrusive name + # label = cfg["name"][-1] + # else: # use the field identifier + # label = k + # ax.annotate( + # "\n".join(label.split()), + # xy=(x, y), + # ha="center", + # va="center", + # **subkwargs(kwargs, ax.annotate, matplotlib.text.Text) + # ) + + + ax.set_ylabel("$K/(K+Na+0.5Ca) molar$") + ax.set_xlabel("$(2Ca+5Fe+2Mn)+(2Ca+5Fe+2Mn+Mg+Si) molar$") + return ax class PeralkalinityClassifier(object): def __init__(self): diff --git a/test/geochem/geochem_alteration.py b/test/geochem/geochem_alteration.py index 3893aaaa..f03052b8 100644 --- a/test/geochem/geochem_alteration.py +++ b/test/geochem/geochem_alteration.py @@ -87,5 +87,19 @@ def test_WIP(self): df.loc[:, "WIP"] = WIP(df) + +class TestAIOCG_xy(unittest.TestCase): + """Tests the AIOCG coordinate calculation.""" + + def setUp(self): + self.cols = ["Si", "Ca", "Mg", "Mn", "Fe", "Ti", "Na", "K", "Al"] + self.df = pd.DataFrame( + {k: v for k, v in zip(self.cols, np.random.rand(len(self.cols), 10))} + ) + + def test_AIOCG_xy(self): + df = self.df + df.loc[:, "AIOCG_x"], df.loc[:, "AIOCG_y"] = AIOCG_xy(df) + if __name__ == "__main__": unittest.main() diff --git a/test/plot/templates/plot_templates_AIOCG.py b/test/plot/templates/plot_templates_AIOCG.py new file mode 100644 index 00000000..5f1c55da --- /dev/null +++ b/test/plot/templates/plot_templates_AIOCG.py @@ -0,0 +1,26 @@ +import unittest +import matplotlib.pyplot as plt +from pyrolite.plot.templates.AIOCG import AIOCG + + +class TestAIOCGPlot(unittest.TestCase): + def setUp(self): + pass + + def test_TAS_default(self): + fig, axes = plt.subplots(1) + for ax in [None, axes]: + with self.subTest(ax=ax): + ax = AIOCG(ax) + + def test_TAS_relim(self): + for relim in [True, False]: + with self.subTest(relim=relim): + ax = AIOCG(relim=relim) + + def tearDown(self): + plt.close("all") + + +if __name__ == "__main__": + unittest.main() From b6a06b2a7f40a0b89490ea082d72215dbc5d027c Mon Sep 17 00:00:00 2001 From: NicolasPietteLauziere <73743596+NicolasPietteLauziere@users.noreply.github.com> Date: Thu, 17 Jun 2021 15:59:16 -0700 Subject: [PATCH 2/4] Update config.json --- pyrolite/data/models/AIOCG/config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyrolite/data/models/AIOCG/config.json b/pyrolite/data/models/AIOCG/config.json index 643c8bfc..4ee8672c 100644 --- a/pyrolite/data/models/AIOCG/config.json +++ b/pyrolite/data/models/AIOCG/config.json @@ -1 +1 @@ -{"name":"AIOCG","axes":{"x":"(2Ca+5Fe+2Mn)+(2Ca+5Fe+2Mn+Mg+Si) molar","y":"K/(K+Na+0.5Ca) molar"},"fields":{"K":{"name":["K"],"poly":[[0,405.2],[103.2,405.2],[109.4,244.1],[51.6,235.0],[39.6,222.8],[45.6,194.4],[0,194.4]]},"KintNa":{"name":[""],"poly":[[0,194.4],[0,121.5],[145.7,121.5],[54.7,176.2],[45.6,194.4]]},"Na":{"name":["K"],"poly":[[0,121.5],[145.7,121.5],[145.7,32.4],[157.9,0.0],[0,0.0]]},"NotAltered1":{"name":[""],"poly":[[291.6,145.9],[221.7,72.5],[294.7,30.5],[346.3,44.6],[352.3,54.7],[346.3,73.0],[334.1,101.3],[315.8,117.6]]},"NotAltered2":{"name":[""],"poly":[[291.6,145.9],[221.7,72.5],[294.7,30.5],[346.3,44.6],[352.3,54.7],[346.3,73.0],[334.1,101.3],[315.8,117.6]]},"Na-Ca-Fe-(Mg)":{"name":["Na-Ca-Fe-(Mg)"],"poly":[[145.7,121.5],[145.7,32.4],[157.9,0.0],[413,0.0],[400.8,48.7],[367.4,77.1],[352.3,117.6],[315.8,117.6],[334.1,101.3],[346.3,73.0],[352.3,54.7],[346.3,44.6],[294.7,30.5],[206.6,81.1]]},"KintK-Fe":{"name":[""],"poly":[[103.2,405.2],[109.4,244.1],[115.4,245.1],[197.5,223.5],[200.4,275.6],[194.4,405.2]]},"K-Fe":{"name":["K-Fe"],"poly":[[194.4,405.2],[200.4,275.6],[197.5,223.5],[200.4,222.8],[437.2,222.8],[431.2,328.1],[413,364.6],[413,405.2]]},"Ca-K-Fe":{"name":["Ca-K-Fe"],"poly":[[200.4,222.8],[291.6,145.9],[315.8,117.6],[352.3,117.6],[443.5,117.6],[437.2,222.8]]},"Ca-Fe-(Mg)":{"name":["Ca-Fe-(Mg)"],"poly":[[352.3,117.6],[367.4,77.1],[400.8,48.7],[413,0.0],[461.7,0.0],[445.4,70.8],[443.5,117.6]]},"Fe-rich_Ca-Fe":{"name":["Fe-rich Ca-Fe"],"poly":[[443.5,117.6],[445.4,70.8],[461.7,0.0],[607.4,0.0],[607.4,117.6]]},"Fe-rich_Ca-K-Fe":{"name":["Fe-rich Ca-K-Fe"],"poly":[[437.2,222.8],[443.5,117.6],[607.4,117.6],[607.4,222.8]]},"Fe-rich_K-Fe":{"name":["Fe-rich K-Fe"],"poly":[[413,405.2],[413,364.6],[431.2,328.1],[437.2,222.8],[607.4,222.8],[607.4,405.2]]}}} +{"name":"AIOCG","axes":{"x":"(2Ca+5Fe+2Mn)+(2Ca+5Fe+2Mn+Mg+Si) molar","y":"K/(K+Na+0.5Ca) molar"},"fields":{"K":{"name":["K"],"poly":[[0,405.2],[103.2,405.2],[109.4,244.1],[51.6,235.0],[39.6,222.8],[45.6,194.4],[0,194.4]]},"KintNa":{"name":[""],"poly":[[0,194.4],[0,121.5],[145.7,121.5],[54.7,176.2],[45.6,194.4]]},"Na":{"name":["Na"],"poly":[[0,121.5],[145.7,121.5],[145.7,32.4],[157.9,0.0],[0,0.0]]},"NotAltered1":{"name":[""],"poly":[[291.6,145.9],[221.7,72.5],[294.7,30.5],[346.3,44.6],[352.3,54.7],[346.3,73.0],[334.1,101.3],[315.8,117.6]]},"NotAltered2":{"name":[""],"poly":[[291.6,145.9],[221.7,72.5],[294.7,30.5],[346.3,44.6],[352.3,54.7],[346.3,73.0],[334.1,101.3],[315.8,117.6]]},"Na-Ca-Fe-(Mg)":{"name":["Na-Ca-Fe-(Mg)"],"poly":[[145.7,121.5],[145.7,32.4],[157.9,0.0],[413,0.0],[400.8,48.7],[367.4,77.1],[352.3,117.6],[315.8,117.6],[334.1,101.3],[346.3,73.0],[352.3,54.7],[346.3,44.6],[294.7,30.5],[206.6,81.1]]},"KintK-Fe":{"name":[""],"poly":[[103.2,405.2],[109.4,244.1],[115.4,245.1],[197.5,223.5],[200.4,275.6],[194.4,405.2]]},"K-Fe":{"name":["K-Fe"],"poly":[[194.4,405.2],[200.4,275.6],[197.5,223.5],[200.4,222.8],[437.2,222.8],[431.2,328.1],[413,364.6],[413,405.2]]},"Ca-K-Fe":{"name":["Ca-K-Fe"],"poly":[[200.4,222.8],[291.6,145.9],[315.8,117.6],[352.3,117.6],[443.5,117.6],[437.2,222.8]]},"Ca-Fe-(Mg)":{"name":["Ca-Fe-(Mg)"],"poly":[[352.3,117.6],[367.4,77.1],[400.8,48.7],[413,0.0],[461.7,0.0],[445.4,70.8],[443.5,117.6]]},"Fe-rich_Ca-Fe":{"name":["Fe-rich Ca-Fe"],"poly":[[443.5,117.6],[445.4,70.8],[461.7,0.0],[607.4,0.0],[607.4,117.6]]},"Fe-rich_Ca-K-Fe":{"name":["Fe-rich Ca-K-Fe"],"poly":[[437.2,222.8],[443.5,117.6],[607.4,117.6],[607.4,222.8]]},"Fe-rich_K-Fe":{"name":["Fe-rich K-Fe"],"poly":[[413,405.2],[413,364.6],[431.2,328.1],[437.2,222.8],[607.4,222.8],[607.4,405.2]]}}} From 20fbb03bc4cda93d77f6ba957f635a72e2b1c84c Mon Sep 17 00:00:00 2001 From: NicolasPietteLauziere <73743596+NicolasPietteLauziere@users.noreply.github.com> Date: Thu, 8 Jul 2021 08:46:23 -0700 Subject: [PATCH 3/4] Edits Edits following Owner's comments. Not stable yet. --- pyrolite/geochem/alteration.py | 7 ++++--- pyrolite/plot/templates/AIOCG.py | 6 +++--- pyrolite/plot/templates/__init__.py | 2 +- pyrolite/util/classification.py | 20 -------------------- 4 files changed, 8 insertions(+), 27 deletions(-) diff --git a/pyrolite/geochem/alteration.py b/pyrolite/geochem/alteration.py index 6f2026f3..4d66be86 100644 --- a/pyrolite/geochem/alteration.py +++ b/pyrolite/geochem/alteration.py @@ -145,8 +145,9 @@ def AIOCG_xy(df: pd.DataFrame): Analysis 13:229-247. doi:``__ """ - x = (2*df.Ca+5*df.Fe+2*df.Mn)/(2*df.Ca+5*df.Fe+2*df.Mn+df.Mg+df.Si)*600 - y = df.K/(df.K+df.Na+0.5*df.Ca)*400 - return x, y + df['(2Ca+5Fe+2Mn)+(2Ca+5Fe+2Mn+Mg+Si)'] = + (2*df.Ca+5*df.Fe+2*df.Mn)/(2*df.Ca+5*df.Fe+2*df.Mn+df.Mg+df.Si) + df['K/(K+Na+0.5Ca)'] = df.K/(df.K+df.Na+0.5*df.Ca) + return df['(2Ca+5Fe+2Mn)+(2Ca+5Fe+2Mn+Mg+Si)','K/(K+Na+0.5Ca)'] diff --git a/pyrolite/plot/templates/AIOCG.py b/pyrolite/plot/templates/AIOCG.py index ad7a91d2..00a83485 100644 --- a/pyrolite/plot/templates/AIOCG.py +++ b/pyrolite/plot/templates/AIOCG.py @@ -1,7 +1,7 @@ import matplotlib.pyplot as plt import numpy as np from ...util.plot.axes import init_axes -from ...util.classification import AIOCG as AIOCGclassifier +from ...util.classification import AIOCG as _AIOCG_Classifier from ...util.meta import sphinx_doi_link, update_docstring_references, subkwargs from ...util.log import Handle @@ -50,8 +50,8 @@ def AIOCG(ax=None, relim=True, color="k", **kwargs): ) ax = init_axes(ax=ax, **kwargs) - aiocg = AIOCGclassifier() - aiocg.add_to_axes(ax=ax, **kwargs) + _AIOCG_Classifier().add_to_axes(ax=ax, **kwargs) + if relim: ax.set_xlim(xlim) ax.set_ylim(ylim) diff --git a/pyrolite/plot/templates/__init__.py b/pyrolite/plot/templates/__init__.py index e72e30be..1e899f6e 100644 --- a/pyrolite/plot/templates/__init__.py +++ b/pyrolite/plot/templates/__init__.py @@ -5,7 +5,7 @@ ---- * Make use of new ax.axline features (https://matplotlib.org/3.3.1/users/whats_new.html#new-axes-axline-method) """ - +from .AIOCG import AIOCG from .pearce import pearceThNbYb, pearceTiNbYb from .TAS import TAS from ...util.log import Handle diff --git a/pyrolite/util/classification.py b/pyrolite/util/classification.py index 758656ae..a9259fc5 100644 --- a/pyrolite/util/classification.py +++ b/pyrolite/util/classification.py @@ -370,26 +370,6 @@ def add_to_axes(self, ax=None, fill=False, axes_scale=100.0, labels=None, **kwar va="center", **subkwargs(kwargs, ax.annotate, matplotlib.text.Text) ) - - - # if cfg["poly"]: - # verts = np.array(cfg["poly"]) * rescale_by - # x, y = get_centroid(matplotlib.patches.Polygon(verts)) - # if "volc" in labels: # use the volcanic name - # label = cfg["name"][0] - # elif "intr" in labels: # use the intrusive name - # label = cfg["name"][-1] - # else: # use the field identifier - # label = k - # ax.annotate( - # "\n".join(label.split()), - # xy=(x, y), - # ha="center", - # va="center", - # **subkwargs(kwargs, ax.annotate, matplotlib.text.Text) - # ) - - ax.set_ylabel("$K/(K+Na+0.5Ca) molar$") ax.set_xlabel("$(2Ca+5Fe+2Mn)+(2Ca+5Fe+2Mn+Mg+Si) molar$") return ax From 97a57bc9c40fdec97d2192d92745e23012175419 Mon Sep 17 00:00:00 2001 From: NicolasPietteLauziere <73743596+NicolasPietteLauziere@users.noreply.github.com> Date: Sun, 5 Sep 2021 12:11:18 -0700 Subject: [PATCH 4/4] Fixing errors --- pyrolite/geochem/alteration.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pyrolite/geochem/alteration.py b/pyrolite/geochem/alteration.py index 4d66be86..b0db482c 100644 --- a/pyrolite/geochem/alteration.py +++ b/pyrolite/geochem/alteration.py @@ -145,9 +145,8 @@ def AIOCG_xy(df: pd.DataFrame): Analysis 13:229-247. doi:``__ """ - df['(2Ca+5Fe+2Mn)+(2Ca+5Fe+2Mn+Mg+Si)'] = - (2*df.Ca+5*df.Fe+2*df.Mn)/(2*df.Ca+5*df.Fe+2*df.Mn+df.Mg+df.Si) + df['(2Ca+5Fe+2Mn)+(2Ca+5Fe+2Mn+Mg+Si)'] = (2*df.Ca+5*df.Fe+2*df.Mn)/(2*df.Ca+5*df.Fe+2*df.Mn+df.Mg+df.Si) df['K/(K+Na+0.5Ca)'] = df.K/(df.K+df.Na+0.5*df.Ca) - return df['(2Ca+5Fe+2Mn)+(2Ca+5Fe+2Mn+Mg+Si)','K/(K+Na+0.5Ca)'] + return df['(2Ca+5Fe+2Mn)+(2Ca+5Fe+2Mn+Mg+Si)'],df['K/(K+Na+0.5Ca)']