157 lines
5.8 KiB
Python
157 lines
5.8 KiB
Python
import ternary
|
|
import matplotlib.pyplot as pp
|
|
import numpy as np
|
|
import data_ternary
|
|
import data_udiagram
|
|
|
|
def plotTdiagram():
|
|
scale = 100
|
|
|
|
groups = [['grt_E11_a', 'grt_E11_b', 'grt_E11_c'], ['grt_E11_d', 'grt_E11_e', 'grt_E11_g'], ['grt_E11_j', 'grt_E11_k'],
|
|
['grt_Fro_b', 'grt_Fro_c', 'grt_Fro_d'], ['grt_Fro_e', 'grt_Fro_f', 'grt_Fro_g'], ['grt_Fro_n', 'grt_Fro_o', 'grt_Fro_p'], ['grt_Fro_q', 'grt_Fro_r', 'grt_Fro_s'],
|
|
['grt_Rane_a', 'grt_Rane_b'], ['grt_Rane_c', 'grt_Rane_d']]
|
|
|
|
for group in groups:
|
|
#group = [group]
|
|
|
|
figure, tax = ternary.figure(scale=scale)
|
|
|
|
# Draw Boundary and Gridlines
|
|
tax.boundary(linewidth=2.0)
|
|
tax.gridlines(color="grey", multiple=20)
|
|
|
|
# Set Axis labels and Title
|
|
fontsize = 12
|
|
offset = 0.14
|
|
#tax.set_title(group+"\n", fontsize=fontsize)
|
|
tax.right_corner_label("Sps", fontsize=fontsize)
|
|
tax.top_corner_label("Grs", fontsize=fontsize)
|
|
tax.left_corner_label("Prp", fontsize=fontsize)
|
|
#tax.left_axis_label("Left label $\\alpha^2$", fontsize=fontsize, offset=offset)
|
|
#tax.right_axis_label("Right label $\\beta^2$", fontsize=fontsize, offset=offset)
|
|
#tax.bottom_axis_label("Bottom label $\\Gamma - \\Omega$", fontsize=fontsize, offset=offset)
|
|
|
|
# Draw lines parallel to the axes
|
|
#tax.horizontal_line(16)
|
|
#tax.left_parallel_line(10, linewidth=2., color='red', linestyle="--")
|
|
#tax.right_parallel_line(20, linewidth=3., color='blue')
|
|
|
|
# Draw an arbitrary line, ternary will project the points for you
|
|
#p1 = (22, 8, 10)
|
|
#p2 = (2, 22, 16)
|
|
#tax.line(p1, p2, linewidth=3., marker='s', color='green', linestyle=":")
|
|
|
|
for item in group:
|
|
points = list(zip(*(data_ternary.data[item]['Sps'],
|
|
data_ternary.data[item]['Grs'],
|
|
data_ternary.data[item]['Prp'],
|
|
)))
|
|
#print(points)
|
|
tax.scatter(points, label=item)
|
|
|
|
#p1 = (data_ternary.data[item][val][0] for val in ['Prp', 'Sps', 'Grs'])
|
|
p1 = points[0]
|
|
#p2 = (data_ternary.data[item][val][-1] for val in ['Prp', 'Sps', 'Grs'])
|
|
p2 = points[-1]
|
|
print(p1, p2)
|
|
#tax.line(p1, p2, linewidth=3., marker='s', color='green', linestyle="-")
|
|
# line.axes.annotate('',
|
|
# xytext=(xdata[start_ind], ydata[start_ind]),
|
|
# xy=(xdata[end_ind], ydata[end_ind]),
|
|
# arrowprops=dict(arrowstyle="->", color=color),
|
|
# size=size
|
|
# )
|
|
|
|
tax.legend(frameon=False)
|
|
|
|
# edit this for ax ticks
|
|
tax.ticks(axis='lbr', multiple=20, linewidth=1, offset=0.025)
|
|
|
|
# leave this alone
|
|
tax.get_axes().axis('off')
|
|
tax.clear_matplotlib_ticks()
|
|
pp.savefig(f"ternary_{group}.png")
|
|
tax.show()
|
|
|
|
def plotUdiagram():
|
|
|
|
figures = {}
|
|
figures["E11-9a_amph_E11_ab"] = pp.subplots(1)
|
|
figures["Fro5-2_amph_Fro_i"] = pp.subplots(1)
|
|
figures["Fro5-2_amph_Fro_j"] = pp.subplots(1)
|
|
figures["Fro5-2_amph_Fro_k"] = pp.subplots(1)
|
|
figures["Fro5-2_amph_Fro_l"] = pp.subplots(1)
|
|
figures["Fro5-2_amph_Fro_m"] = pp.subplots(1)
|
|
figures["Fro5-2_amph_Fro_o"] = pp.subplots(1)
|
|
figures["Fro12-4_amph_Fro_ad"] = pp.subplots(1)
|
|
figures["Fro12-4_amph_Fro_ah"] = pp.subplots(1)
|
|
figures["Fro12-4_amph_Fro_ai"] = pp.subplots(1)
|
|
figures["Fro12-4_amph_Fro_aj"] = pp.subplots(1)
|
|
figures["Fro1312b1_amph_Fro_bb"] = pp.subplots(1)
|
|
figures["Fro1312b1_amph_Fro_be"] = pp.subplots(1)
|
|
figures["Fro1312b1_amph_Fro_bi"] = pp.subplots(1)
|
|
figures["Rane10-3_amph_Rane_a"] = pp.subplots(1)
|
|
figures["Rane10-3_amph_Rane_b"] = pp.subplots(1)
|
|
figures["Rane10-3_amph_Rane_c"] = pp.subplots(1)
|
|
figures["Rane10-3_amph_Rane_e"] = pp.subplots(1)
|
|
figures["Rane10-3_amph_Rane_f"] = pp.subplots(1)
|
|
figures["Rane10-4_amph_Rane_g"] = pp.subplots(1)
|
|
figures["Rane10-4_amph_Rane_l"] = pp.subplots(1)
|
|
figures["Rane10-4_amph_Rane_m"] = pp.subplots(1)
|
|
figures["Rane10-10_amph_Rane_p"] = pp.subplots(1)
|
|
figures["Rane10-10_amph_Rane_q"] = pp.subplots(1)
|
|
figures["Rane10-10_amph_Rane_r"] = pp.subplots(1)
|
|
figures["Rane10-10_amph_Rane_s"] = pp.subplots(1)
|
|
figures["Rane10-10_amph_Rane_t"] = pp.subplots(1)
|
|
figures["Rane10-10_amph_Rane_u"] = pp.subplots(1)
|
|
figures["Rane10-10_amph_Rane_v"] = pp.subplots(1)
|
|
figures["Rane10-10_amph_Rane_w"] = pp.subplots(1)
|
|
|
|
for g in data_udiagram.data.keys():
|
|
|
|
dat = data_udiagram.data[g]
|
|
|
|
for i, zone in enumerate(dat['zones']):
|
|
fig, ax = figures[f"{g}_{zone}"]
|
|
ax.plot(dat['index'][i], dat['al4'][i], label="Al(IV)", color="blue", marker=".")
|
|
ax.plot(dat['index'][i], dat['al6'][i], label="Al(VI)", color="orange", marker=".")
|
|
ax.set_xlabel("No.")
|
|
ax.set_ylabel("pfu")
|
|
ax.set_title(f"{g}: {zone}")
|
|
ax.legend(frameon=False)
|
|
ax.xaxis.get_major_locator().set_params(integer=True)
|
|
|
|
fig.savefig(f"uplot_{g}_{zone}.png")
|
|
|
|
pp.show()
|
|
|
|
|
|
def plotZdiagram():
|
|
|
|
#fig, ax = pp.subplots(1)
|
|
|
|
for g in data_udiagram.data.keys():
|
|
|
|
fig, ax = pp.subplots(1, num=g)
|
|
dat = data_udiagram.data[g]
|
|
|
|
for i, zone in enumerate(dat['zones']):
|
|
ax.plot(dat['al4'][i], dat['al6'][i], label=f"{zone}", marker=".")
|
|
ax.set_xlabel("Al(IV)")
|
|
ax.set_ylabel("Al(VI)")
|
|
ax.set_title(g)
|
|
ax.legend(frameon=False)
|
|
#ax.xaxis.get_major_locator().set_params(integer=True)
|
|
|
|
fig.savefig(f"zplot_{g}.png")
|
|
|
|
pp.show()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
pass
|
|
|
|
#plotTdiagram()
|
|
plotUdiagram()
|
|
plotZdiagram()
|