implement ptplot

This commit is contained in:
fordprefect
2023-08-13 19:14:46 +02:00
parent 2746d10564
commit ede67b5af6

View File

@@ -4,6 +4,7 @@ import numpy as np
import data_ternary
import data_udiagram
import data_ediagram
import data_ptdiagram
def plotTdiagram():
scale = 100
@@ -24,45 +25,17 @@ def plotTdiagram():
# 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
@@ -71,8 +44,8 @@ def plotTdiagram():
# leave this alone
tax.get_axes().axis('off')
tax.clear_matplotlib_ticks()
pp.savefig(f"ternary_{group}.png")
tax.show()
pp.savefig(f"ternary_{'_'.join(group)}.png")
#tax.show()
def plotUdiagram():
@@ -159,10 +132,26 @@ def plotEdiagram():
fig.savefig(f"eplot_{firstname}")
pp.show()
def plotPTdiagram():
for label in data_ptdiagram.data:
print(label)
pp.figure(label)
for region in ["core", "transition", "rim"]:
pp.plot(data_ptdiagram.data[label][region]["p"], data_ptdiagram.data[label][region]["t"], marker="o", linestyle="", label=region)
pp.legend(frameon=False)
pp.xlabel("p [kbar]")
pp.ylabel("T [°C]")
pp.title(label)
pp.savefig(f"ptplot_{label}.png")
pp.show()
if __name__ == "__main__":
pass
#plotTdiagram()
plotUdiagram()
plotZdiagram()
#plotUdiagram()
#plotZdiagram()
#plotEdiagram()
plotPTdiagram()