Skip to content

Instantly share code, notes, and snippets.

@yonesuke

yonesuke/plot.py Secret

Created March 20, 2021 12:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yonesuke/dcf880846bad725eadad4e6f59566935 to your computer and use it in GitHub Desktop.
Save yonesuke/dcf880846bad725eadad4e6f59566935 to your computer and use it in GitHub Desktop.
import numpy as np
import matplotlib.pyplot as plt
plt.rcParams["text.usetex"] = True
plt.rcParams["text.latex.preamble"] = r"\usepackage{amsmath,bm}"
plt.rcParams["font.family"] = "serif"
xs = np.arange(0, 1, 0.01)
ys = xs ** 2
plt.figure(figsize=[8, 6])
plt.rcParams["font.size"] = 15
plt.xlim(0, 1)
plt.ylim(0, 1)
plt.plot(xs, ys)
plt.xlabel("$x$")
plt.ylabel("$f(x)=x^{2}$")
plt.savefig("out.png")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment