.. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_advanced_image_processing_auto_examples_plot_radial_mean.py: Radial mean ============ This example shows how to do a radial mean with scikit-image. .. image:: /advanced/image_processing/auto_examples/images/sphx_glr_plot_radial_mean_001.png :class: sphx-glr-single-img .. code-block:: python import numpy as np import scipy from scipy import ndimage import matplotlib.pyplot as plt f = scipy.misc.face(gray=True) sx, sy = f.shape X, Y = np.ogrid[0:sx, 0:sy] r = np.hypot(X - sx/2, Y - sy/2) rbin = (20* r/r.max()).astype(np.int) radial_mean = ndimage.mean(f, labels=rbin, index=np.arange(1, rbin.max() +1)) plt.figure(figsize=(5, 5)) plt.axes([0, 0, 1, 1]) plt.imshow(rbin, cmap=plt.cm.nipy_spectral) plt.axis('off') plt.show() **Total running time of the script:** ( 0 minutes 0.213 seconds) .. _sphx_glr_download_advanced_image_processing_auto_examples_plot_radial_mean.py: .. only :: html .. container:: sphx-glr-footer :class: sphx-glr-footer-example .. container:: sphx-glr-download :download:`Download Python source code: plot_radial_mean.py ` .. container:: sphx-glr-download :download:`Download Jupyter notebook: plot_radial_mean.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_