Start implementing plot functionality
This commit is contained in:
parent
162e884d47
commit
f85e41460b
45
src/plot.py
Normal file
45
src/plot.py
Normal file
@ -0,0 +1,45 @@
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
import pandas as pd
|
||||
import seaborn as sns
|
||||
|
||||
sns.set_theme()
|
||||
sns.dark_palette("seagreen")
|
||||
|
||||
"""Write to file (for dense matrix):
|
||||
Line give size of matrix (column give number of transformations until convergence)
|
||||
N 1 (2 3 4 5)
|
||||
3
|
||||
6
|
||||
9
|
||||
12
|
||||
15
|
||||
"""
|
||||
|
||||
def read_data(filename: str) -> tuple:
|
||||
N = []
|
||||
T = []
|
||||
with open(filename, "r") as f:
|
||||
lines = f.readlines()
|
||||
for line in lines:
|
||||
n_i, t_i = line.strip().split(",")
|
||||
N.append(float(n_i))
|
||||
T.append(float(t_i))
|
||||
return (N, T)
|
||||
|
||||
|
||||
|
||||
def plot_similarity_transformations(N: np.ndarray, T: np.ndarray) -> None:
|
||||
fig, ax = plt.subplots()
|
||||
ax.plot(N, T, label='Transformations')
|
||||
ax.set_xlabel('N')
|
||||
ax.set_ylabel('Similarity transformations')
|
||||
ax.set_xlim(xmin=N[0], xmax=N[-1])
|
||||
fig.savefig("similarity_transformation.pdf")
|
||||
|
||||
def plot_eigenvectors():
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
pass
|
||||
Loading…
Reference in New Issue
Block a user