Skip to content

Instantly share code, notes, and snippets.

View ISDementyev's full-sized avatar
💻
Computational Protein Design

Ilya S. Dementyev ISDementyev

💻
Computational Protein Design
View GitHub Profile
@ISDementyev
ISDementyev / plot_latex.py
Last active March 29, 2023 11:41
Matplotlib plot with LaTeX (Computer Modern) font
import matplotlib.pyplot as plt
plt.style.use('seaborn') # I personally prefer seaborn for the graph style, but you may choose whichever you want.
params = {"ytick.color" : "black",
"xtick.color" : "black",
"axes.labelcolor" : "black",
"axes.edgecolor" : "black",
"text.usetex" : True,
"font.family" : "serif",
"font.serif" : ["Computer Modern Serif"]}
#reproduces the "stats" or "verbose" output from LINEST in Excel or Google Sheets
import numpy as np
data = np.genfromtxt('data.csv', delimiter=',', names=True)
x = data['x']
y = data['y']
n = len(y)
dofreedom = n-2