To customize the plot and create the dashed line pattern, which of the following parameter is used?
To customize the plot and create the dashed line pattern, which of the following parameter is used?
Solution
✅ Correct Option: 1
In Matplotlib, the linestyle parameter (short form ls) sets the line pattern of a plot, for example plt.plot(x, y, linestyle='dashed') or linestyle='--'.
Options 2, 3 and 4: linetype, line_type and line_style are not valid Matplotlib keyword arguments, and using them raises an error. R's lty and linetype (in ggplot2) are the likely source of the confusion.
Other common values are 'solid' ('-'), 'dotted' (':') and 'dashdot' ('-.').
Related questions:
2026: 21 May Shift 1
2025: 14 May Shift 1
2026: 31 May Shift 1
2025: 16 May Shift 1