http://qiita.com/hik0107/items/de5785f680096df93efa
I will refer to the article above, and even if I try to run it with jupyter, the graph will not be displayed unless plt.show ()
is used.
I thought it would be displayed without show ()
because it looks like a REPL, but is it different? When I looked it up, it seemed that I needed a spell.
%matplotlib inline
#Preparation of what is necessary for graphing
import matplotlib
import matplotlib.pyplot as plt
#Library required for handling data
import pandas as pd
import numpy as np
import datetime as dt
plt.style.use('ggplot')
font = {'family' : 'meiryo'}
matplotlib.rc('font', **font)
url = 'https://vincentarelbundock.github.io/Rdatasets/csv/robustbase/ambientNOxCH.csv'
df_sample = pd.read_csv(url, parse_dates=1, index_col=1)
#Preparing df
df = df_sample.iloc[:, 1:]
# df_Preparing for monthly
df_monthly = df.copy()
df_monthly.index = df_monthly.index.map(lambda x: x.month)
df_monthly = df_monthly.groupby(level=0).sum()
df_monthly.plot.bar(y=['ad', 'ba', 'se'], alpha=0.6, figsize=(12,3))
plt.title(u'Ordinary bar graph', size=16)
Recommended Posts