In [0]:
import numpy as np
In [0]:
x = np.linspace(1, 10, 10)
In [0]:
x
Out[0]:
array([ 1.,  2.,  3.,  4.,  5.,  6.,  7.,  8.,  9., 10.])
In [0]:
y = x ** 2
In [0]:
y
Out[0]:
array([  1.,   4.,   9.,  16.,  25.,  36.,  49.,  64.,  81., 100.])
In [0]:
import matplotlib.pyplot as plt
In [0]:
plt.plot(x, y)
Out[0]:
[<matplotlib.lines.Line2D at 0x7f7ee0afd780>]
In [0]:
plt.scatter(x, y)
Out[0]:
<matplotlib.collections.PathCollection at 0x7f7ede28e2b0>
In [0]:
plt.plot(x, y, color="red")
Out[0]:
[<matplotlib.lines.Line2D at 0x7f7ede28e6a0>]
In [0]:
plt.plot(x, y, "red")
Out[0]:
[<matplotlib.lines.Line2D at 0x7f7ede1ca198>]
In [0]:
plt.plot(x, y, "r")
Out[0]:
[<matplotlib.lines.Line2D at 0x7f7ede1a0358>]
In [0]:
plt.plot(x, y, color="red", ls="-.", lw=10)
Out[0]:
[<matplotlib.lines.Line2D at 0x7f7eddf0c6d8>]
In [0]:
plt.plot(x, y, color="red", ls="-.", lw=2)
plt.xlabel(r"$time(\mu s)$")
plt.ylabel("position (m)")
Out[0]:
Text(0, 0.5, 'position (m)')
In [0]:
font = {"size": 24, "fontname": "Times New Roman"}
plt.plot(x, y, color="red", ls="-.", lw=2)
plt.xlabel(r"$time(\mu s)$", fontdict=font)
plt.ylabel("position (m)", fontdict=font)
Out[0]:
Text(0, 0.5, 'position (m)')
/usr/local/lib/python3.6/dist-packages/matplotlib/font_manager.py:1241: UserWarning: findfont: Font family ['Times New Roman'] not found. Falling back to DejaVu Sans.
  (prop.get_family(), self.defaultFamily[fontext]))
In [0]:
plt.rc("font", family="Times New Roman", size=24)
plt.plot(x, y, color="red", ls="-.", lw=2)
plt.xlabel(r"$time(\mu s)$")
plt.ylabel("position (m)")
plt.title("Math")
Out[0]:
Text(0.5, 1.0, 'Math')
/usr/local/lib/python3.6/dist-packages/matplotlib/font_manager.py:1241: UserWarning: findfont: Font family ['Times New Roman'] not found. Falling back to DejaVu Sans.
  (prop.get_family(), self.defaultFamily[fontext]))
In [0]:
z = x * 2
In [0]:
z
Out[0]:
array([ 2.,  4.,  6.,  8., 10., 12., 14., 16., 18., 20.])
In [0]:
plt.rc("font", family="Times New Roman", size=24)
plt.plot(x, y, color="red", ls="-.", lw=2)
plt.scatter(x, z)
plt.xlabel(r"$time(\mu s)$")
plt.ylabel("position (m)")
plt.title("Math")
Out[0]:
Text(0.5, 1.0, 'Math')
In [0]:
plt.rc("font", family="Times New Roman", size=24)
plt.plot(x, y, color="red", ls="-.", lw=2, label="y")
plt.scatter(x, z, label="z")
plt.xlabel(r"$time(\mu s)$")
plt.ylabel("position (m)")
plt.title("Math")
plt.legend()
Out[0]:
<matplotlib.legend.Legend at 0x7f7eddd6a588>
In [0]:
plt.rc("font", family="Times New Roman", size=24)
plt.style.use("ggplot")
plt.plot(x, y, color="red", ls="-.", lw=2, label="y")
plt.scatter(x, z, label="z")
plt.xlabel(r"$time(\mu s)$")
plt.ylabel("position (m)")
plt.title("Math")
plt.legend()
plt.savefig("exp_1.tif", dpi=300)
In [0]: