Skip to content

Commit 9317f72

Browse files
authored
Update get.py
1 parent 8f72097 commit 9317f72

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

braininventory/get.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,3 +154,28 @@ def report():
154154
report["locations"] = __get_locations(df)
155155

156156
return report
157+
158+
def create_tree_map(frequency_dict, width, height):
159+
"""
160+
Get a treemap of projects
161+
162+
Input parameter: dictionary
163+
Output: treemap image
164+
"""
165+
labels = list(frequency_dict.keys())
166+
values = list(frequency_dict.values())
167+
168+
fig = go.Figure(go.Treemap(
169+
labels=labels,
170+
parents=[''] * len(labels),
171+
values=values,
172+
textinfo='label+value'
173+
))
174+
175+
fig.update_layout(title='Projects', width=width, height=height)
176+
177+
today = date.today()
178+
output_path = f'treemap-{today.strftime("%Y%m%d")}.png'
179+
fig.write_image(output_path)
180+
fig.show()
181+

0 commit comments

Comments
 (0)