Which attribute of plot() function is used to set the style of line in a line chart?
Which attribute of plot() function is used to set the style of line in a line chart?
Solution
✅ Correct Option: 4
The linestyle parameter of matplotlib's plot() function sets the style of the line. Values include '-' (solid), '--' (dashed), ':' (dotted) and '-.' (dash-dot). It can be shortened to ls.
Example: plt.plot(x, y, linestyle='--')
Options 1, 2 and 3: these are not valid plot() parameters, and passing them raises an error.
Related questions:
2025: 15 May Shift 2
2026: 11 May Shift 2
2026: 13 May Shift 2
