Created
October 22, 2021 23:37
-
-
Save manuelinfosec/3bda71bbfdc525ac1de63a463df06d0b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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