Skip to content

Commit 666d179

Browse files
author
Ivan Cao-Berg
committed
Refactor setup.py: removed unnecessary code for downloading JSON file, reading and plotting treemap.
1 parent 30dbf7b commit 666d179

File tree

1 file changed

+1
-36
lines changed

1 file changed

+1
-36
lines changed

setup.py

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -19,39 +19,4 @@
1919
"Operating System :: OS Independent",
2020
],
2121
python_requires=">=3.6",
22-
)
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)
22+
)

0 commit comments

Comments
 (0)