-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathplotting.py
More file actions
32 lines (27 loc) · 741 Bytes
/
plotting.py
File metadata and controls
32 lines (27 loc) · 741 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# -*- coding: utf-8 -*-
"""
Created on Mon Oct 28 13:57:30 2019
@author: tothp
"""
import matplotlib.pyplot as pl
import numpy as np
import pandas as pd
def plot_share_of_frequencies(
counts: pd.DataFrame,
name: str = "UME_name"
) -> None:
k = 0
x = np.arange(len(counts))
vals_old = None
for name, vals in counts.iteritems():
if name != "UME_name":
if k == 0:
bottom = np.zeros(vals.shape)
else:
bottom = bottom + vals_old
pl.bar(x, vals, 1, bottom=bottom)
vals_old = vals
k = k + 1
pl.xticks(x, labels=counts[name], rotation=-90, fontsize=8)
pl.ylim([0, 1])
pl.xlim([x.min(), x.max()])