# /// script
# requires-python = ">=3.13"
# dependencies = [
# "matplotlib",
# ]
# ///
import matplotlib.pyplot as plt
import numpy as np
#plt.style.use('_mpl-gallery')
# make data
x = np.linspace(0, 10, 100)
print(x)
#y = 4 + 1 * np.sin(2 * x)
#x2 = np.linspace(0, 10, 25)
#y2 = 4 + 1 * np.sin(2 * x2)
#
## plot
#fig, ax = plt.subplots()
#
#ax.plot(x2, y2 + 2.5, 'x', markeredgewidth=2)
#ax.plot(x, y, linewidth=2.0)
#ax.plot(x2, y2 - 2.5, 'o-', linewidth=2)
#
#ax.set(xlim=(0, 8), xticks=np.arange(1, 8),
# ylim=(0, 8), yticks=np.arange(1, 8))
#
#plt.show()
# /// script
# requires-python = ">=3.13"
# dependencies = [
# "matplotlib",
# ]
# ///
import matplotlib.pyplot as plt
x = [v / 100 for v in range(200)]
y_linear = x
y_square = [v*v for v in x]
y_cube = [v**3 for v in x]
#print(y_cube)
plt.figure(figsize=(5, 2.7), layout='constrained')
plt.plot(x, y_linear, label='linear')
plt.plot(x, y_square, label='quadratic')
plt.plot(x, y_cube, label='cubic')
plt.xlabel('x label')
plt.ylabel('y label')
plt.title("Plot numbers")
plt.legend()
plt.show()
# /// script
# requires-python = ">=3.13"
# dependencies = [
# "matplotlib",
# "numpy",
# ]
# ///
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0, 2, 100)
plt.figure(figsize=(5, 2.7), layout='constrained')
plt.plot(x, x, label='linear')
plt.plot(x, x**2, label='quadratic')
plt.plot(x, x**3, label='cubic')
plt.xlabel('x label')
plt.ylabel('y label')
plt.title("Plot numbers")
plt.legend()
plt.show()
import matplotlib.pyplot as plt
plt.plot([1, 2, 3, 4], [1, 4, 9, 16], 'ro')
# setting the size of the graph
#plt.axis((0, 6, 0, 20)) # [xmin, xmax, ymin, ymax]
plt.show()