.. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_plot_sparsecone.py: ==== Cone ==== Sparse Cone .. code-block:: python from __future__ import absolute_import, print_function, division import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D # noqa from km3pipe.math import SparseCone import km3pipe.style km3pipe.style.use("moritz") spike = [0, 0, 1] bottom = [0, 0, 0] angle = np.pi / 4 n_angles = 20 cone = SparseCone(spike, bottom, angle) circ_samp = cone.sample_circle(n_angles=n_angles) axis_samp = cone.sample_axis samp = cone.sample(n_angles) samp = np.array(samp) .. rst-class:: sphx-glr-script-out Out: .. code-block:: none Loading style definitions from '/home/docs/checkouts/readthedocs.org/user_builds/km3pipe/conda/stable/lib/python3.5/site-packages/km3pipe/kp-data/stylelib/moritz.mplstyle' plot the same in 3D because why not? .. code-block:: python plt.clf() fig = plt.figure() ax = fig.add_subplot(111, projection='3d') ax.scatter(samp[:, 0], samp[:, 1], samp[:, 2], 'yo') plt.show() .. rst-class:: sphx-glr-horizontal * .. image:: /auto_examples/images/sphx_glr_plot_sparsecone_001.png :class: sphx-glr-multi-img * .. image:: /auto_examples/images/sphx_glr_plot_sparsecone_002.png :class: sphx-glr-multi-img **Total running time of the script:** ( 0 minutes 0.072 seconds) .. _sphx_glr_download_auto_examples_plot_sparsecone.py: .. only :: html .. container:: sphx-glr-footer :class: sphx-glr-footer-example .. container:: sphx-glr-download :download:`Download Python source code: plot_sparsecone.py ` .. container:: sphx-glr-download :download:`Download Jupyter notebook: plot_sparsecone.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_