.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_gallery/plot_example_data_on_topo.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_gallery_plot_example_data_on_topo.py: Plot data on topography =========================== This example demonstrates how to display data on topography using plot_data_on_topo from the plot module. .. GENERATED FROM PYTHON SOURCE LINES 8-9 Initial import .. GENERATED FROM PYTHON SOURCE LINES 9-14 .. code-block:: Python import matplotlib.pyplot as plt from pytopomap.tools import read_tiff from pytopomap.plot import plot_data_on_topo .. GENERATED FROM PYTHON SOURCE LINES 15-16 Load data from a GeoTIFF file (available on github) .. GENERATED FROM PYTHON SOURCE LINES 16-22 .. code-block:: Python url_topo = r"https://raw.githubusercontent.com/marcperuz/pytopomap/main/data/z.tif" url_data = r"https://raw.githubusercontent.com/marcperuz/pytopomap/main/data/h_deposits.tif" x, y, z = read_tiff(url_topo) x, y, data = read_tiff(url_data) .. GENERATED FROM PYTHON SOURCE LINES 23-24 Basic usage: display data imshow on topography. .. GENERATED FROM PYTHON SOURCE LINES 24-28 .. code-block:: Python axe = plot_data_on_topo(x, y, z, data, minval_abs=0.1) plt.show() .. image-sg:: /auto_gallery/images/sphx_glr_plot_example_data_on_topo_001.png :alt: plot example data on topo :srcset: /auto_gallery/images/sphx_glr_plot_example_data_on_topo_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 29-44 Customized display with advanced parameters ------------------------------------------- You can adjust many parameters of plot_topo and plot_imshow such as: - 'minval', 'maxval' or 'cmap_intervals': control the colormap range - 'alpha': transparency of the data layer - 'minval_abs': threshold to mask small values - 'topo_kwargs': settings for the underlying topography (e.g., shading, exaggeration) - 'mask', 'alpha_mask', 'color_mask': to overlay a binary mask (e.g., invalid zones) - 'xlims', 'ylims': to zoom on a specific area .. GENERATED FROM PYTHON SOURCE LINES 44-55 .. code-block:: Python mask = (z>200)*(z<500) axe = plot_data_on_topo( x, y, z, data, minval=10, maxval=100, mask=mask, color_mask='red', alpha_mask=0.5, cmap_intervals=[10, 50, 100], ) .. image-sg:: /auto_gallery/images/sphx_glr_plot_example_data_on_topo_002.png :alt: plot example data on topo :srcset: /auto_gallery/images/sphx_glr_plot_example_data_on_topo_002.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.944 seconds) .. _sphx_glr_download_auto_gallery_plot_example_data_on_topo.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_example_data_on_topo.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_example_data_on_topo.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_example_data_on_topo.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_