Skip to content
Snippets Groups Projects
Commit 376fe7cf authored by Sortofamudkip's avatar Sortofamudkip
Browse files

Merge branch 'master' of...

Merge branch 'master' of gitup.uni-potsdam.de:nifranz/rse-23-group-assignment-shervud-pitawanik-franz
parents 39cc8572 c7fbac58
No related branches found
No related tags found
No related merge requests found
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from .Dataset import Dataset
class Plotter:
def __init__(self, dataset: Dataset):
self.df = dataset.get_dataframe()
def plotCategoricalBarChart(self, category1, category2, title):
ct = pd.crosstab(self.df[category1], self.df[category2])
ct_percent = ct.apply(lambda r: r/r.sum() * 100, axis=0) # Calculate percentages by row
fig, ax = plt.subplots()
ax.set_title(title)
ct_percent.plot(kind='bar', ax=ax)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment