Untitled

mail@pastecode.io avatar
unknown
plain_text
18 days ago
781 B
3
Indexable
Never
import matplotlib.pyplot as plt
import numpy as np

# Set up the plot
fig, ax = plt.subplots()

# Define the x range for the boundary line
x = np.linspace(-10, 10, 400)

# Define the y boundary line (y = 5)
y_boundary = 5

# Plot the boundary line (y = 5)
plt.plot(x, y_boundary * np.ones_like(x), 'r--', label='y = 5')

# Shade the region y < 5
plt.fill_between(x, -10, y_boundary, where=(x >= -10), color='red', alpha=0.3)

# Set the plot limits
plt.xlim(-10, 10)
plt.ylim(-10, 10)

# Adding labels and title
plt.xlabel('x')
plt.ylabel('y')
plt.title('Graph of the Inequality y < 5')

# Add a legend
plt.legend()

# Show the plot
plt.grid(True)
plt.axhline(0, color='black',linewidth=0.5)
plt.axvline(0, color='black',linewidth=0.5)
plt.show()
Leave a Comment