.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/plot_interactive_wikipedia.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_auto_examples_plot_interactive_wikipedia.py: Interactive Wikipedia --------------------- Demonstrating interactive plotting with a Simple Wikipedia data map. For a full size version see https://lmcinnes.github.io/datamapplot_examples/Wikipedia_data_map_example.html .. GENERATED FROM PYTHON SOURCE LINES 10-53 .. raw:: html


.. code-block:: Python import gzip import numpy as np import datamapplot wikipedia_data_map = np.load("wikipedia_layered_data_map.npz")["arr_0"] wikipedia_label_layers = [] for i in range(6): wikipedia_label_layers.append( np.load(f"wikipedia_layer{i}_cluster_labels.npz", allow_pickle=True)["arr_0"] ) with gzip.open( "wikipedia_large_hover_text.txt.gz", mode="rt", encoding="utf-8" ) as file_hover_text: wikipedia_hover_text = np.fromiter( (line.strip() for line in file_hover_text.readlines()), "object" ) wikipedia_marker_size_array = np.load("wikipedia_marker_size_array.npz")["arr_0"] plot = datamapplot.create_interactive_plot( wikipedia_data_map, wikipedia_label_layers[0], wikipedia_label_layers[1], wikipedia_label_layers[3], wikipedia_label_layers[5], hover_text=wikipedia_hover_text, title="Map of Wikipedia", sub_title="Paragraphs from articles on Simple Wikipedia embedded with Cohere embed", logo="https://asset.brandfetch.io/idfDTLvPCK/idyv4d98RT.png", font_family="Marcellus SC", background_color="#eae6de", marker_size_array=wikipedia_marker_size_array, cluster_boundary_polygons=True, cluster_boundary_line_width=0.5, initial_zoom_fraction=0.99, inline_data=False, offline_data_prefix="wikipedia_gallery", enable_density_overview=True, density_overview_tile_resolution=1024, density_overview_n_jobs=4, density_overview_n_levels=2, ) plot .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 37.812 seconds) .. _sphx_glr_download_auto_examples_plot_interactive_wikipedia.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_interactive_wikipedia.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_interactive_wikipedia.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_interactive_wikipedia.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_