.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/demo.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_demo.py: ================================ Demo USGS patterns ================================ .. GENERATED FROM PYTHON SOURCE LINES 7-47 .. rst-class:: sphx-glr-horizontal * .. image-sg:: /examples/images/sphx_glr_demo_001.png :alt: 601, 602, 603, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644 :srcset: /examples/images/sphx_glr_demo_001.png :class: sphx-glr-multi-img * .. image-sg:: /examples/images/sphx_glr_demo_002.png :alt: 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671, 672, 673, 674, 675, 676, 677, 678, 679, 680, 681, 682, 683, 684, 685, 686 :srcset: /examples/images/sphx_glr_demo_002.png :class: sphx-glr-multi-img * .. image-sg:: /examples/images/sphx_glr_demo_003.png :alt: 701, 702, 703, 704, 705, 706, 707, 708, 709, 710, 711, 712, 713, 714, 715, 716, 717, 719, 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 730, 731, 732, 733 :srcset: /examples/images/sphx_glr_demo_003.png :class: sphx-glr-multi-img .. code-block:: Python import itertools import matplotlib.pyplot as plt from matplotlib.patches import Rectangle # import mpl_visual_context.patheffects as pe from mpl_pe_pattern_usgs import PatternUSGS pm = PatternUSGS() kk = [k for k in sorted(pm.roots.keys()) if k > "600"] while kk: fig = plt.figure(figsize=(6, 7)) gs = fig.add_gridspec(7, 6) for gs1 in gs: ax = fig.add_subplot(gs1) ax.axis("off") patch = Rectangle((0, 0), 1, 1, fc="k", ec="k", transform=ax.transAxes, ) ax.add_patch(patch) if kk: k = kk.pop(0) pattern = pm.get(k, scale=4) patch.set_path_effects([# pe.FillOnly(), pattern.fill(ax), ]) ax.set_title(k) else: break fig.tight_layout() plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 4.219 seconds) .. _sphx_glr_download_examples_demo.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: demo.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: demo.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_