-
Notifications
You must be signed in to change notification settings - Fork 0
/
DataPlotAFM.py
88 lines (77 loc) · 5.07 KB
/
DataPlotAFM.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#############################################################################################################
#############################################################################################################
# Author: 8230W #
#############################################################################################################
# Code Description #
#############################################################################################################
# Code to plot thermodynamic data for AFM ising data #
#############################################################################################################
# Inputs #
#############################################################################################################
# Must read in csv file containing thermodynamic data for AFM lattice #
#############################################################################################################
# Outputs #
#############################################################################################################
# Produces plots of C, m, Susceptibility, e, sublattice magnetisation #
#############################################################################################################
#############################################################################################################
import matplotlib.pyplot as plt
import matplotlib
import pandas as pd
import numpy as np
from matplotlib import rc
# activate latex text rendering
rc('text', usetex=True)
#set plot parameters
matplotlib.rcParams.update({'font.size': 40})
matplotlib.rcParams.update({'errorbar.capsize': 2})
plt.rcParams["font.family"] = "Times New Roman"
#read in data to be plotted
data = pd.read_csv(r'C:\Users\Theo\PartIII\FINAL_AFM_L20.csv')
#plot specific heat on two different scales
Plot_SpecificHeat = pd.DataFrame(data, columns = ['Temperature', 'Specific Heat', 'Specific Heat SD'])
Plot_SpecificHeat['log(T)'] = np.log10(Plot_SpecificHeat['Temperature'])
Plot_SpecificHeat.plot.scatter(x = 'Temperature', y = 'Specific Heat', yerr = 'Specific Heat SD', marker = '+', s = 100, color='black')
plt.grid(linestyle='--', linewidth='0.5', color='g')
plt.xlabel("Temperature", fontsize = 45)
plt.ylabel("Specific Heat", fontsize = 45)
plt.show()
Plot_SpecificHeat.plot.scatter(x = 'log(T)',y = 'Specific Heat', yerr = 'Specific Heat SD', marker = '+', s = 100, color='black')
plt.grid(linestyle='--', linewidth='0.5', color='g')
plt.xlabel("log(Temperature)", fontsize = 45)
plt.ylabel("Specific Heat", fontsize = 45)
plt.show()
#plot average spin
Plot_AverageSpin = pd.DataFrame(data, columns = ['Temperature', 'Average Spin', 'Spin SD'])
Plot_AverageSpin.plot.scatter(x = 'Temperature', y = 'Average Spin', yerr = 'Spin SD', marker = '+', s = 100, color='black')
plt.grid(linestyle='--', linewidth='0.5', color='g')
plt.xlabel("Temperature", fontsize = 45)
plt.ylabel("Average Spin", fontsize = 45)
plt.show()
#plot susceptibility on two different scales
Plot_Susceptibility = pd.DataFrame(data, columns = ['Temperature', 'Susceptibility', 'Susceptibility SD'])
Plot_Susceptibility.plot.scatter(x = 'Temperature', y = 'Susceptibility', yerr = 'Susceptibility SD', marker = '+', s = 100, color='black')
plt.grid(linestyle='--', linewidth='0.5', color='g')
plt.xlabel("Temperature", fontsize = 45)
plt.ylabel("Susceptibility", fontsize = 45)
plt.show()
Plot_Susceptibility['log(T)'] = np.log10(Plot_SpecificHeat['Temperature'])
Plot_Susceptibility.plot.scatter(x = 'log(T)', y = 'Susceptibility', yerr = 'Susceptibility SD', marker = '+', s = 100, color='black')
plt.grid(linestyle='--', linewidth='0.5', color='g')
plt.xlabel("log(Temperature)", fontsize = 45)
plt.ylabel("Susceptibility", fontsize = 45)
plt.show()
#plote average energy
Plot_AverageEnergy = pd.DataFrame(data, columns = ['Temperature', 'Average Energy', 'Energy SD'])
Plot_AverageEnergy.plot.scatter(x = 'Temperature', y = 'Average Energy', yerr = 'Energy SD', marker = '+', s = 100, color='black')
plt.grid(linestyle='--', linewidth='0.5', color='g')
plt.xlabel("Temperature", fontsize = 45)
plt.ylabel("Average Energy", fontsize = 45)
plt.show()
#plot sublattice magnetisation of one sublattice
Plot_AverageM1 = pd.DataFrame(data, columns = ['Temperature', 'M1', 'M1 SD'])
Plot_AverageM1.plot.scatter(x = 'Temperature', y = 'M1', yerr = 'M1 SD', marker = '+', s = 100, color='black')
plt.grid(linestyle='--', linewidth='0.5', color='g')
plt.xlabel("Temperature", fontsize = 45)
plt.ylabel("M1", fontsize = 45)
plt.show()