.. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_packages_scikit-image_auto_examples_plot_sobel.py: Computing horizontal gradients with the Sobel filter ===================================================== This example illustrates the use of the horizontal Sobel filter, to compute horizontal gradients. .. image:: /packages/scikit-image/auto_examples/images/sphx_glr_plot_sobel_001.png :class: sphx-glr-single-img .. code-block:: python from skimage import data from skimage import filters import matplotlib.pyplot as plt text = data.text() hsobel_text = filters.sobel_h(text) plt.figure(figsize=(12, 3)) plt.subplot(121) plt.imshow(text, cmap='gray', interpolation='nearest') plt.axis('off') plt.subplot(122) plt.imshow(hsobel_text, cmap='nipy_spectral', interpolation='nearest') plt.axis('off') plt.tight_layout() plt.show() **Total running time of the script:** ( 0 minutes 0.072 seconds) .. _sphx_glr_download_packages_scikit-image_auto_examples_plot_sobel.py: .. only :: html .. container:: sphx-glr-footer :class: sphx-glr-footer-example .. container:: sphx-glr-download :download:`Download Python source code: plot_sobel.py ` .. container:: sphx-glr-download :download:`Download Jupyter notebook: plot_sobel.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_