-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstacked_bar.py
37 lines (31 loc) · 865 Bytes
/
stacked_bar.py
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
33
34
35
36
37
# ---
# jupyter:
# jupytext:
# formats: ipynb,py:light
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.3.2
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# +
### Plot stacked bar data read from csv file
# Render plots inline
# %matplotlib inline
from os.path import expandvars
import pandas as pd
import matplotlib.pyplot as plt
plt.rcParams['figure.figsize'] = (15, 5)
# change dir to jupyter project folder
import os
os.chdir(expandvars('$HOME/gitwork/github/jupyter-notebooks'))
# -
df = pd.read_csv('./data/fnbp2.csv', encoding='latin1', sep=';',
parse_dates=['date'], index_col='date' ) # usecols=
# Show the first rows
df[:3]
df.plot.bar(stacked=True, color=['green','blue','red','lightgrey']);