Skip to content

Instantly share code, notes, and snippets.

@detrin
Created October 21, 2019 08:17
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 detrin/1aed3172c6a5e323e1eba7a2e5082fe5 to your computer and use it in GitHub Desktop.
Save detrin/1aed3172c6a5e323e1eba7a2e5082fe5 to your computer and use it in GitHub Desktop.
Matplotlib test
import numpy as np
import matplotlib.pyplot as plt
import random
from matplotlib import rc
rc('font',**{'family':'serif','serif':['Helvetica']})
rc('text', usetex=True)
start, stop, step = 1, 10, 0.4
data_x = [x for x in np.arange(start, stop, step)]
data_y = [(10-x)*0.2+4+random.uniform(-1, 1) for x in np.arange(start, stop, step)]
plt.ylabel(r'$-\frac{d T}{d x}\:(\mathrm{MeV\cdot cm}^{-1})$', fontsize=12)
plt.xlabel(r'$T\:(\mathrm{MeV})$' , fontsize=12)
plt.plot(data_x, data_y, "k.", label="label")
# plt.show()
plt.savefig("test.png", size=(4, 3), dpi=600)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment