@@ -812,9 +812,15 @@ to create a gallery of images in the :file:`/doc/gallery` and
812812:file: `/doc/tutorials ` directories respectively. To exclude an example
813813from having an plot generated insert "sgskip" somewhere in the filename.
814814
815+
816+ Formatting the example
817+ ----------------------
818+
815819The format of these files is relatively straightforward. Properly
816820formatted comment blocks are treated as ReST _ text, the code is
817- displayed, and figures are put into the built page.
821+ displayed, and figures are put into the built page. Matplotlib uses the
822+ ``# %% `` section separator so that IDEs will identify "code cells" to make
823+ it easy to re-run sub-sections of the example.
818824
819825For instance the example :doc: `/gallery/lines_bars_and_markers/simple_plot `
820826example is generated from
@@ -853,7 +859,7 @@ Tutorials are made with the exact same mechanism, except they are longer, and
853859typically have more than one comment block (i.e.
854860:doc: `/tutorials/introductory/quick_start `). The first comment block
855861can be the same as the example above. Subsequent blocks of ReST text
856- are delimited by a line of ``### `` characters :
862+ are delimited by the line ``# %% `` :
857863
858864.. code-block :: python
859865
@@ -868,7 +874,7 @@ are delimited by a line of ``###`` characters:
868874 ax.grid()
869875 plt.show()
870876
871- # #########################################################################
877+ # %%
872878 # Second plot
873879 # ===========
874880 #
@@ -887,7 +893,7 @@ bottom as follows
887893
888894.. code-block :: python
889895
890- # ##############################################################################
896+ # %%
891897 #
892898 # .. admonition:: References
893899 #
0 commit comments