Skip to content

Commit 33117e5

Browse files
authored
Update setup.py
1 parent 8f72097 commit 33117e5

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

setup.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,38 @@
2020
],
2121
python_requires=">=3.6",
2222
)
23+
import pandas as pd
24+
import urllib.request
25+
26+
url = 'https://download.brainimagelibrary.org/inventory/daily/reports/today.json'
27+
file_path, _ = urllib.request.urlretrieve(url)
28+
df = pd.read_json(file_path)
29+
30+
#get affiliations
31+
affiliations = df['genotype'].value_counts().to_dict()
32+
affiliations
33+
34+
!pip install kaleido
35+
36+
import plotly.graph_objects as go
37+
from datetime import date
38+
39+
def create_tree_map(frequency_dict):
40+
labels = list(frequency_dict.keys())
41+
values = list(frequency_dict.values())
42+
43+
fig = go.Figure(go.Treemap(
44+
labels=labels,
45+
parents=[''] * len(labels),
46+
values=values,
47+
textinfo='label+value'
48+
))
49+
50+
fig.update_layout(title='Genotypes')
51+
52+
today = date.today()
53+
output_path = f'treemap-{today.strftime("%Y%m%d")}.png'
54+
fig.write_image(output_path)
55+
fig.show()
56+
57+
create_tree_map(affiliations)

0 commit comments

Comments
 (0)