.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/gallery-examples/sphinx-gallery.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_examples_gallery-examples_sphinx-gallery.py: Sphinx-Gallery ============== This example shows how to add a new example when using `Sphinx-Gallery `_. To use Sphinx-Gallery, first install the package with this command: .. code-block:: bash pip install sphinx-gallery Then, add the package to the ``extensions`` variable in your Sphinx ``conf.py`` file: .. code-block:: python extensions = [ "sphinx_gallery.gen_gallery", ] .. GENERATED FROM PYTHON SOURCE LINES 46-49 Plot a simple sphere using PyVista ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This code plots a simple sphere using PyVista. .. GENERATED FROM PYTHON SOURCE LINES 49-57 .. code-block:: Python import pyvista as pv pv.set_jupyter_backend("html") sphere = pv.Sphere() sphere.plot() .. GENERATED FROM PYTHON SOURCE LINES 58-59 Plot a simple sphere using PyVista with a plotter .. GENERATED FROM PYTHON SOURCE LINES 59-65 .. code-block:: Python plotter = pv.Plotter(notebook=True) plotter.add_mesh(sphere, color="white", show_edges=True) plotter.title = "3D Sphere Visualization" plotter.show() .. GENERATED FROM PYTHON SOURCE LINES 66-69 Render equations using IPython ``math`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This example shows how to render equations using the IPython ``math`` module. .. GENERATED FROM PYTHON SOURCE LINES 69-77 .. code-block:: Python from IPython.display import Math, display # LaTeX formatted equation equation = r"\int\limits_{-\infty}^\infty f(x) \delta(x - x_0) \, dx = f(x_0)" # Display the equation display(Math(equation)) .. GENERATED FROM PYTHON SOURCE LINES 78-82 .. code-block:: Python from IPython.display import Latex Latex(r"This is a \LaTeX{} equation: $a^2 + b^2 = c^2$") .. GENERATED FROM PYTHON SOURCE LINES 83-95 Render a table in markdown ~~~~~~~~~~~~~~~~~~~~~~~~~~ This is an example to render a table inside the markdown with Sphinx-Gallery. ====== ====== ======= A B A and B ====== ====== ======= False False False True False False False True False True True True ====== ====== ======= .. GENERATED FROM PYTHON SOURCE LINES 97-98 Render a table using pandas .. GENERATED FROM PYTHON SOURCE LINES 98-114 .. code-block:: Python import pandas as pd # Create a dictionary of data data = { "A": [True, False, True, False], "B": [False, True, False, True], "C": [True, True, False, False], } # Create DataFrame from the dictionary df = pd.DataFrame(data) # Display the DataFrame df.head() .. _sphx_glr_download_examples_gallery-examples_sphinx-gallery.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: sphinx-gallery.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: sphinx-gallery.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: sphinx-gallery.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_