Skip to content

Instantly share code, notes, and snippets.

@manuelinfosec
Created October 22, 2021 23:37
Show Gist options
  • Save manuelinfosec/3bda71bbfdc525ac1de63a463df06d0b to your computer and use it in GitHub Desktop.
Save manuelinfosec/3bda71bbfdc525ac1de63a463df06d0b to your computer and use it in GitHub Desktop.
# import modules
from matplotlib import pyplot as plt
from numpy import sin, cos
# create coordinates
x = [10,20,30,40,50]
y = [30,30,30,30,30]
# create plots with labels
plt.plot(x, y, 'r', label = "line 1", linestyle="-")
plt.plot(y, x, 'g+', label = "line 2", linestyle="--")
plt.plot(x, sin(x), label = "sine curve", linestyle="-.") # (x - sin(x))
plt.plot(x, cos(x), label = "cosine curve", linestyle=":") # (x - cos(x))
# display graph
plt.tight_layout() # decrease graph's padding
plt.legend() # display line labels
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment