.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/05_heatmap.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_examples_05_heatmap.py: Heatmap ======= A heatmap allows you to visualize the distribution of a specific attribute across a 3D block model from a 2D perspective. .. GENERATED FROM PYTHON SOURCE LINES 9-19 .. code-block:: default import tempfile import numpy as np import pandas as pd from pathlib import Path import plotly.graph_objects as go from parq_blockmodel import ParquetBlockModel .. GENERATED FROM PYTHON SOURCE LINES 20-23 Create a Parquet Block Model ---------------------------- We leverage the create_demo_block_model class method to create a Parquet Block Model. .. GENERATED FROM PYTHON SOURCE LINES 23-31 .. code-block:: default temp_dir = Path(tempfile.gettempdir()) / "block_model_example" temp_dir.mkdir(parents=True, exist_ok=True) pbm: ParquetBlockModel = ParquetBlockModel.create_demo_block_model( filename=temp_dir / "demo_block_model.parquet") pbm .. rst-class:: sphx-glr-script-out .. code-block:: none ParquetBlockModel(name=demo_block_model, path=/tmp/block_model_example/demo_block_model.pbm.parquet) .. GENERATED FROM PYTHON SOURCE LINES 32-35 Create Heatmap -------------- We'll create a heatmap plot in plan view. .. GENERATED FROM PYTHON SOURCE LINES 35-42 .. code-block:: default fig: go.Figure = pbm.plot_heatmap(attribute='c_index', threshold=4, axis='z') fig .. raw:: html


.. GENERATED FROM PYTHON SOURCE LINES 43-44 view the heatmap matrix .. GENERATED FROM PYTHON SOURCE LINES 44-50 .. code-block:: default heatmap_matrix: np.ndarray = pbm.create_heatmap_from_threshold(attribute='c_index', threshold=4, axis='z', return_array=True) heatmap_matrix .. rst-class:: sphx-glr-script-out .. code-block:: none pyvista_ndarray([[2, 2, 3], [2, 2, 3], [2, 3, 3]]) .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.925 seconds) .. _sphx_glr_download_auto_examples_05_heatmap.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: 05_heatmap.py <05_heatmap.py>` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: 05_heatmap.ipynb <05_heatmap.ipynb>` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_