Last active
January 19, 2019 03:28
-
-
Save ceptreee/9d87dd4dc335df9ee50945209923a922 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
import sympy as sb | |
x = sb.Symbol('x') | |
xx = np.linspace(0,1,1000) | |
plt.rcParams["font.size"] = 12 | |
plt.rcParams['text.usetex'] = True | |
plt.figure(figsize=(6,6)) | |
for i in range(4): | |
f = sb.sin((i+1)*sb.pi*x) | |
ff = sb.lambdify(x,f) | |
plt.subplot(2,2,i+1) | |
plt.title('$'+'f_{%d}(x) = ' % (i+1) + sb.latex(f)+'$') | |
plt.plot(xx,ff(xx)) | |
plt.tight_layout() | |
plt.subplots_adjust(top=0.85) | |
txt = r'$f_i(x) = \sin(i \pi x)$' | |
plt.figtext(0.5,0.95,txt,fontsize=15,ha='center',va='center') | |
plt.savefig('test.png') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment