from Wieser et al. (2021b) from the 2018 eruption of Kilauea -You can download the data here: https://github.com/PennyWieser/Thermobar/blob/main/docs/Examples/General_Plotting/Plotting_inputs_Amp_Cpx_Ol_Fspar.xlsx
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import Thermobar as pt
import ternary
plt.rcParams["font.family"] = 'arial'
plt.rcParams["font.size"] =12
plt.rcParams["mathtext.default"] = "regular"
plt.rcParams["mathtext.fontset"] = "dejavusans"
plt.rcParams['patch.linewidth'] = 1
plt.rcParams['axes.linewidth'] = 1
plt.rcParams["xtick.direction"] = "in"
plt.rcParams["ytick.direction"] = "in"
plt.rcParams["ytick.direction"] = "in"
plt.rcParams["xtick.major.size"] = 6 # Sets length of ticks
plt.rcParams["ytick.major.size"] = 4 # Sets length of ticks
plt.rcParams["ytick.labelsize"] = 12 # Sets size of numbers on tick marks
plt.rcParams["xtick.labelsize"] = 12 # Sets size of numbers on tick marks
plt.rcParams["axes.titlesize"] = 14 # Overall title
plt.rcParams["axes.labelsize"] = 14 # Axes labels
## Loading Pyroxenes
Px_dict=pt.import_excel('Plotting_inputs_Amp_Cpx_Ol_Fspar.xlsx',
sheet_name='Pyroxenes_F8')
Px_Comps=Px_dict['Cpxs']
tern_points=pt.tern_points_px(px_comps=Px_Comps)
C:\Users\penny\anaconda3\lib\site-packages\pandas\core\indexing.py:2115: FutureWarning: In a future version, the Index constructor will not infer numeric dtypes when passed object-dtype sequences (matching Series behavior) new_ix = Index(new_ix)
# First, define the plot, e.g., here, we specify we want the grid, and labels
fig, tax = pt.plot_px_classification(figsize=(10, 5), fontsize_component_labels=12,
major_grid=True, minor_grid=True)
## Now feed in your data we calculated at the start in terms of ternary axes!
tax.scatter(
tern_points,
edgecolor="k",
marker="^",
facecolor="red",
label='Label1',
s=90
)
<AxesSubplot:>
Px_Comps['Sample_ID_Cpx'].unique()
array(['LL5', 'LL3', 'LL1', 'LL9', 'LL11', 'LL12', 'LL8', 'LL10', 'LL6', 'LL2'], dtype=object)
Px_Comps_LL5=tern_points[Px_Comps['Sample_ID_Cpx']=="LL5"]
Px_Comps_LL3=tern_points[Px_Comps['Sample_ID_Cpx']=="LL3"]
Px_Comps_LL1=tern_points[Px_Comps['Sample_ID_Cpx']=="LL1"]
Px_Comps_LL9=tern_points[Px_Comps['Sample_ID_Cpx']=="LL9"]
Px_Comps_LL11=tern_points[Px_Comps['Sample_ID_Cpx']=="LL11"]
Px_Comps_LL12=tern_points[Px_Comps['Sample_ID_Cpx']=="LL12"]
Px_Comps_LL8=tern_points[Px_Comps['Sample_ID_Cpx']=="LL8"]
Px_Comps_LL10=tern_points[Px_Comps['Sample_ID_Cpx']=="LL8"]
Px_Comps_LL6=tern_points[Px_Comps['Sample_ID_Cpx']=="LL6"]
Px_Comps_LL2=tern_points[Px_Comps['Sample_ID_Cpx']=="LL2"]
# First, define the plot, e.g., here, we specify we want the grid, and labels
fig, tax = pt.plot_px_classification(figsize=(10, 5), fontsize_component_labels=12,
major_grid=True, minor_grid=True)
## Now feed in your data we calculated at the start in terms of ternary axes!
tax.scatter(
Px_Comps_LL2,
edgecolor="k",
marker="d",
facecolor="grey",
label='Label1',
s=90
)
<AxesSubplot:>
Early_Samples=np.concatenate((Px_Comps_LL10, Px_Comps_LL9,
Px_Comps_LL12, Px_Comps_LL11,
Px_Comps_LL6, Px_Comps_LL3), axis=0)
# First, define the plot, e.g., here, we specify we want the grid, and labels
fig, tax = pt.plot_px_classification(figsize=(7, 4), fontsize_component_labels=12,
major_grid=True, minor_grid=True, labels=True)
## Adding the dacitic sample as grey diamonds
tax.scatter(
Early_Samples,
edgecolor="k",
marker="s",
facecolor="green",
label='May 4-7',
s=80
)
tax.scatter(
Px_Comps_LL2,
edgecolor="k",
marker="d",
facecolor="grey",
label='May 14',
s=90, zorder=100
)
tax.scatter(
Px_Comps_LL1,
edgecolor="k",
marker="o",
facecolor="cyan",
label='May 15',
s=70
)
tax.scatter(
Px_Comps_LL5,
edgecolor="k",
marker="o",
facecolor="blue",
label='May 16',
s=70
)
tax.legend(loc='upper right', facecolor='white', framealpha=1)
fig.savefig('Px_Classification_Kil.png', dpi=300)