Advertisements
Advertisements
Question
On providing a single list or array to the plot() function, can matplotlib generate values for both the x and y axiz?
Short Answer
Advertisements
Solution
- Yes, when only a single list or array is provided to the plot() function, Matplotlib automatically generates the values for the x-axis.
- The given list values are taken as y-axis values, and the x-axis values are generated automatically starting from 0.
import matplotlib.pyplot as plt
plt.plot([10, 20, 30, 40])
plt.show()shaalaa.com
Is there an error in this question or solution?
