Skip to content

Commit

Permalink
Update plot templates example (TAS, sandstones)
Browse files Browse the repository at this point in the history
  • Loading branch information
morganjwilliams committed May 30, 2023
1 parent 48a860e commit a2c3807
Showing 1 changed file with 31 additions and 4 deletions.
35 changes: 31 additions & 4 deletions docs/source/gallery/examples/plotting/templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,34 @@
from pyrolite.plot.templates import TAS, SpinelFeBivariate
from pyrolite.util.plot.axes import share_axes

# sphinx_gallery_thumbnail_number = 3
# sphinx_gallery_thumbnail_number = 4


ax = TAS(linewidth=0.5, add_labels=True)
plt.show()
########################################################################################
# A few different variants are now available, with slightly different positioning of
# field boundaries, and with some fields combined:
#
fig, ax = plt.subplots(1, 3, figsize=(12, 4))

TAS(ax=ax[0], linewidth=0.5, add_labels=True, which_model=None) # Middlemost's TAS
TAS(ax=ax[1], linewidth=0.5, add_labels=True, which_model="LeMaitre") # LeMaitre's TAS
TAS(ax=ax[2], linewidth=0.5, add_labels=True, which_model="LeMaitreCombined")

for a in ax[1:]:
a.set(yticks=[], ylabel=None)
########################################################################################
# For distinguishing Fe-rich variants of spinel phases, the bivariate spinel
# diagram can be useful:
#
ax = SpinelFeBivariate(linewidth=0.5, add_labels=True)
plt.show()
########################################################################################
# The other bivariate templates currently included in :mod:`pyrolite` are the
# :func:`~pyrolite.plot.templates.pearceThNbYb` and
# :func:`~pyrolite.plot.templates.pearceTiNbYb` diagrams.
# pyrolite contains templates for the Pearce diagrams, used to discriminate mafic rocks
# (and particularly basalts) based on their whole-rock geochemistry. Two templates are
# included: :func:`~pyrolite.plot.templates.pearceThNbYb` and
# :func:`~pyrolite.plot.templates.pearceTiNbYb`.
# We can create some axes and add these templates to them:
#
from pyrolite.plot.templates import pearceThNbYb, pearceTiNbYb
Expand All @@ -44,6 +57,20 @@

plt.tight_layout() # nicer spacing for axis labels
########################################################################################
# pyrolite also now includes some diagram templates for discrimination of sandstones
# based on their whole-rock geochemistry (:func:`~pyrolite.plot.templates.pearceThNbYb`,
# :func:`~pyrolite.plot.templates.Herron`):
#
from pyrolite.plot.templates import Pettijohn, Herron

fig, ax = plt.subplots(1, 2, figsize=(10, 4))
share_axes(ax, which="x") # these diagrams have the same x axis

Pettijohn(ax=ax[0], add_labels=True)
Herron(ax=ax[1], add_labels=True)

plt.tight_layout()
########################################################################################
# Ternary Templates
# ~~~~~~~~~~~~~~~~~~
# pyrolite now also includes ternary classification diagrams inlcuding
Expand Down

0 comments on commit a2c3807

Please sign in to comment.