-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Wikipedia interactive example; start interactive sizing docs
- Loading branch information
Showing
3 changed files
with
1,627 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import numpy as np | ||
import datamapplot | ||
|
||
wikipedia_data_map = np.load("/Users/leland/PycharmProjects/datamapplot/examples/wikipedia_layered_data_map.npy") | ||
wikipedia_label_layers = [] | ||
for i in range(6): | ||
wikipedia_label_layers.append( | ||
np.load(f"/Users/leland/PycharmProjects/datamapplot/examples/wikipedia_layer{i}_cluster_labels.npy", allow_pickle=True) | ||
) | ||
wikipedia_hover_text = [ | ||
x.strip() | ||
for x in open( | ||
"/Users/leland/PycharmProjects/datamapplot/examples/wikipedia_large_hover_text.txt", | ||
mode="r" | ||
) | ||
] | ||
wikipedia_marker_size_array = np.load("../doc/wikipedia_marker_size_array.npy") | ||
|
||
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, | ||
initial_zoom_fraction=0.4, | ||
) | ||
plot |