Plot a Point or a Line on an Image with Matplotlib
Matplotlib and its constituents support a lot of functionality. One such functionality is that we can draw a line or a point on an image using Matplotlib in python.
- Import modules
- Read the image
- Plot the line or point on the image
- Display the plot/image.
Implementation using the above approach on the given image is provided below:
Example 1 : Drawing a point on the image.
Attribute used: marker
It is used to define what marker type should the point be displayed in.
Example 2 : Draw a line on the image
To draw a line we will give the co-ordinates of two points in the plot function.
Attribute used: linewidth
Used to specify the width of the line.
Example 3 : Draw two intersecting lines crossing each other to make X.