infrastructure, first proposal for ternary plots
This commit is contained in:
88
plots_für_johann.py
Normal file
88
plots_für_johann.py
Normal file
@@ -0,0 +1,88 @@
|
||||
import ternary
|
||||
import matplotlib.pyplot as pp
|
||||
import numpy as np
|
||||
import data_ternary
|
||||
import data_udiagram
|
||||
import data_zdiagram
|
||||
|
||||
|
||||
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():
|
||||
raise NotImplementedError()
|
||||
|
||||
def plotZdiagram():
|
||||
raise NotImplementedError()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
pass
|
||||
|
||||
plotTdiagram()
|
||||
Reference in New Issue
Block a user