.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "extensions/sphinx-gallery/plot_07_no_output.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_extensions_sphinx-gallery_plot_07_no_output.py: Text-Only ================= This example demonstrates a gallery entry without any figures. It shows how sphinx-gallery handles code-focused examples with extensive documentation and no visual output. .. note:: Examples without figures use a default placeholder thumbnail in the gallery view. .. GENERATED FROM PYTHON SOURCE LINES 14-17 .. code-block:: Python import matplotlib.pyplot as plt .. GENERATED FROM PYTHON SOURCE LINES 18-22 Working with Data Structures ---------------------------- This section shows basic Python data manipulation without plots. .. GENERATED FROM PYTHON SOURCE LINES 22-33 .. code-block:: Python data = { "name": "Example", "values": [1, 2, 3, 4, 5], "metadata": {"version": "1.0", "author": "Demo"}, } print("Data structure:") for key, value in data.items(): print(f" {key}: {value}") .. rst-class:: sphx-glr-script-out .. code-block:: none Data structure: name: Example values: [1, 2, 3, 4, 5] metadata: {'version': '1.0', 'author': 'Demo'} .. GENERATED FROM PYTHON SOURCE LINES 34-38 List Comprehensions ------------------- Demonstrating various list operations and transformations. .. GENERATED FROM PYTHON SOURCE LINES 38-50 .. code-block:: Python numbers = list(range(10)) print(f"Original: {numbers}") # Filter even numbers evens = [n for n in numbers if n % 2 == 0] print(f"Even numbers: {evens}") # Square each number squares = [n**2 for n in numbers] print(f"Squares: {squares}") .. rst-class:: sphx-glr-script-out .. code-block:: none Original: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] Even numbers: [0, 2, 4, 6, 8] Squares: [0, 1, 4, 9, 16, 25, 36, 49, 64, 81] .. GENERATED FROM PYTHON SOURCE LINES 51-55 String Formatting ----------------- Various ways to format strings in Python. .. GENERATED FROM PYTHON SOURCE LINES 55-65 .. code-block:: Python name = "World" count = 42 # f-string (recommended) print(f"Hello, {name}! Count: {count}") # format method print("Hello, {}! Count: {}".format(name, count)) .. rst-class:: sphx-glr-script-out .. code-block:: none Hello, World! Count: 42 Hello, World! Count: 42 .. GENERATED FROM PYTHON SOURCE LINES 66-74 Summary ------- This example demonstrates that sphinx-gallery can handle pure Python examples without any matplotlib figures. The output from ``print()`` statements is captured and displayed. Note: A minimal hidden plot is included to ensure execution. .. GENERATED FROM PYTHON SOURCE LINES 74-80 .. code-block:: Python # sphinx_gallery_thumbnail_path = '_static/no_image.png' plt.figure(figsize=(1, 1)) plt.axis("off") plt.close() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.006 seconds) .. _sphx_glr_download_extensions_sphinx-gallery_plot_07_no_output.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_07_no_output.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_07_no_output.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_07_no_output.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_