
- Python Basic Tutorial
- Python - Home
- Python - Overview
- Python - Environment Setup
- Python - Basic Syntax
- Python - Comments
- Python - Variables
- Python - Data Types
- Python - Operators
- Python - Decision Making
- Python - Loops
- Python - Numbers
- Python - Strings
- Python - Lists
- Python - Tuples
- Python - Dictionary
- Python - Date & Time
- Python - Functions
- Python - Modules
- Python - Files I/O
- Python - Exceptions
How can I plot hysteresis threshold in Matplotlib?
To plot hysteresis threshold in Matplotlib, we can take the following steps −
- Set the figure size and adjust the padding between and around the subplots.
- Create a figure and a set of subplots.
- Load some greek coins, Greek coins from Pompeii.
- Find, high, low, and edges of the images using the sobel filter.
- Apply hysteresis thresholding to "image".
- Display the data as an image, i.e., on a 2D regular raster, using imshow() method.
- Set the titles for the original image and the image with hysteresis threshold.
- To display the figure, use show() method.
Example
import matplotlib.pyplot as plt from skimage import data, filters plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True fig, ax = plt.subplots(nrows=1, ncols=2) orig_img = data.coins() edges = filters.sobel(orig_img) low = 0.1 high = 0.4 low = (edges > low).astype(int) height = (edges > high).astype(int) hyst = filters.apply_hysteresis_threshold(edges, low, high) ax[0].imshow(height + hyst, cmap='magma') ax[0].set_xlabel('Hysteresis threshold') ax[1].imshow(orig_img, cmap='magma') ax[1].set_xlabel('Original Image') plt.show()
Output
- Related Articles
- How can I plot a confusion matrix in matplotlib?
- How can I plot a single point in Matplotlib Python?
- How can I place a table on a plot in Matplotlib?
- How can I make a scatter plot colored by density in Matplotlib?
- How can I plot two different spaced time series on one same plot in Python Matplotlib?
- How can I plot NaN values as a special color with imshow in Matplotlib?
- How can I get the output of a Matplotlib plot as an SVG?
- How do I plot only a table in Matplotlib?
- Can I give a border to a line in Matplotlib plot function?
- How can I make the xtick labels of a plot be simple drawings using Matplotlib?
- How do I plot a step function with Matplotlib in Python?
- How do I plot multiple X or Y axes in Matplotlib?
- How do I plot hatched bars using Pandas and Matplotlib?
- How do I plot Shapely polygons and objects using Matplotlib?
- How can I show figures separately in Matplotlib?

Advertisements