plot lines
Title
Question
when I enter my command the figure or the graph doesn't pop up
and I am using MacBook Pro with ipython 8.23 and python 3.12
Python-3.4.3 Using-plot-command-interactively 04-05 min 50-60 sec
Answers:
Please follow the tutorial. Enter this command linspace correctly for getting the graph.
import numpy as np
import matplotlib.pyplot as plt
# Generate data points using linspace
x = np.linspace(0, 10, 100) # Generates 100 evenly spaced points between 0 and 10
y = np.sin(x) # Example function (you can replace this with your own)
# Plot the graph
plt.plot(x, y)
plt.xlabel('X-axis label')
plt.ylabel('Y-axis label')
plt.title('Title of the Plot')
plt.grid(True) # Add grid lines
plt.show() # Display the plot
Login to add comment