In [1]: import matplotlib.
pyplot as plt
import numpy as np
# Data
x = [Link](0, 10, 100) # 100 points between 0 and 10
y = x
# Plot
[Link](x, y, label="y = x")
[Link]("x")
[Link]("y")
[Link]("Simple Line Graph of y = x")
[Link]()
[Link]()
In [2]: import [Link] as plt
import numpy as np
# Data
x = [Link](0, 10, 100)
y1 = x
y2 = x**2
# Plot both lines
[Link](x, y1, label="y = x", color="blue")
[Link](x, y2, label="y = x²", color="red")
[Link]("x")
[Link]("y")
[Link]("Two Lines on Same Axes")
[Link]()
[Link]()
In [3]: import [Link] as plt
import numpy as np
# Random data
x = [Link](50) # 50 random numbers between 0 and 1
y = [Link](50)
# Scatter plot
[Link](x, y, color="green", marker="o")
[Link]("x")
[Link]("y")
[Link]("Scatter Plot of Random Numbers")
[Link]()
In [4]: import [Link] as plt
import numpy as np
# Data
x = [Link](0, 2*[Link], 100)
y = [Link](x)
# Plot
[Link](x, y, label="y = sin(x)", color="purple")
[Link]("x")
[Link]("y")
[Link]("Graph of y = sin(x)")
[Link]()
[Link]()