Lines and markers are key components found among various plots. Many times, we may want to customize their appearance to better distinguish different datasets or for better or more consistent styling. Whereas markers are mainly used to show data, such as line plots and scatter plots, lines are involved in various components, such as grids, axes, and box outlines. Like text properties, we can easily apply similar settings for different line or marker objects with the same method.
Most lines in Matplotlib are drawn with the lines
class, including the ones that display the data and those setting area boundaries. Their style can be adjusted by altering parameters in lines.Line2D
. We usually set color
, linestyle
, and linewidth
as keyword arguments. These can be written in shorthand as c
, ls
, and lw
respectively. In the case of simple line graphs, we learned in Chapter 1, Hello Plotting World! that these parameters can be parsed to the plt.plot()
function:
import...