This is an edited verison of Dr. Wang's matplotlib file to demonstrate Jupyter Notebook access via HPC.
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(-2, 2, 500)
y = x**2
plt.title("Square function")
plt.xlabel("x")
plt.ylabel("y = x**2")
plt.plot(x, y,'g--') # specify styles using g-- green dashed lines
plt.show()
Check out this website for more styles to control https://matplotlib.org/2.0.2/api/pyplot_api.html
import matplotlib.pyplot as plt
import numpy as np
import math
x = np.linspace(-2, 2, 500)
y = x**3+(math.sqrt(3)*(x))
plt.title("Title")
plt.xlabel("x")
plt.ylabel("y")
plt.plot(x, y)
plt.show()
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(-5, 5, 500)
dashes = [10, 5, 100, 5] # 10 points on, 5 off, 100 on, 5 off
fig, ax = plt.subplots()
line1, = ax.plot(x, np.sin(x), '--', linewidth=2,
label='Dashes set retroactively')
line1.set_dashes(dashes)
line2, = ax.plot(x, -1 * np.sin(x), dashes=[30, 5, 10, 5],
label='Dashes set proactively')
ax.legend(loc='lower right')
plt.title("Infinity Loop")
plt.xlabel("Time")
plt.ylabel("Space")
plt.show()
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(-2, 2, 500)
fig, ax1 = plt.subplots()
plt.title(":)")
plt.xlabel("Smile Size (cm)")
plt.ylabel("Number of Exposed Teeth")
fig, ax2 = plt.subplots()
plt.title(":/")
plt.xlabel("Frown Size (cm)")
plt.ylabel("Number of Muscles Excerted")
fig, ax3 = plt.subplots()
plt.title("Range of Emoji")
plt.xlabel("Expressiveness")
plt.ylabel("Gestures")
line, = ax1.plot(x, x**2, linewidth=3)
line, = ax2.plot(x, x-2,'g-')
line1, = ax3.plot(x, x**2, linewidth=3)
line2, = ax3.plot(x, x-2,'g-')
t = np.arange(0.0, 2.0, 0.01)
s = np.sin(3 * np.pi * t)
upper = 0.77
lower = -0.77
supper = np.ma.masked_where(s < upper, s)
slower = np.ma.masked_where(s > lower, s)
smiddle = np.ma.masked_where((s < lower) | (s > upper), s)
fig, ax = plt.subplots()
plt.title(":||")
plt.xlabel("Microexpression Detection (ms)")
plt.ylabel("Pheromone Composition Complexity")
ax.plot(t, smiddle, t, slower, t, supper)
plt.show()