In [1]:
%autosave 0


Autosave disabled

suneku.plot


In [2]:
from pandas import read_csv
from suneku import REPO, hello, plot
hello(plot)


module

Data visualization tools.


In [3]:
ENERGY = REPO/'data/NewYorkEnergy.csv'
TEMPS = REPO/'data/ZonalTempAnomaly.csv'

read data from CSV files


In [4]:
energy = ( read_csv(ENERGY,index_col='Year')
        .drop(columns=['Total'])
        .astype(float) )

energy.tail()


Out[4]:
Coal NaturalGas Petroleum ConvHydro PsHydro Nuclear NetImports Other Waste LFG Wood Wind Solar
Year
1984 21902.0 15395.0 28891.0 26586.0 NaN 21187.0 10812.0 NaN NaN NaN NaN 0.0 NaN
1983 20753.0 12428.0 34380.0 26162.0 NaN 16376.0 11888.0 NaN NaN NaN NaN 0.0 NaN
1982 20807.0 13974.0 32932.0 25329.0 NaN 14438.0 10196.0 NaN NaN NaN NaN 0.0 NaN
1981 19632.0 11566.0 36760.0 25658.0 NaN 17444.0 7137.0 NaN NaN NaN NaN 0.0 NaN
1980 19643.0 10766.0 37834.0 26241.0 NaN 19276.0 5575.0 NaN NaN NaN NaN 0.0 NaN

In [5]:
temps = ( read_csv(TEMPS,index_col='Year')
        .drop(columns=['Glob','NHem','SHem'])
        .astype(float) )
    
temps.tail()


Out[5]:
24N-90N 24S-24N 90S-24S 64N-90N 44N-64N 24N-44N EQU-24N 24S-EQU 44S-24S 64S-44S 90S-64S
Year
2011 0.93 0.37 0.58 2.09 0.91 0.57 0.39 0.36 0.68 0.26 0.91
2012 0.97 0.52 0.45 1.88 0.91 0.72 0.47 0.56 0.60 0.25 0.32
2013 0.88 0.58 0.54 1.20 1.04 0.68 0.58 0.57 0.64 0.30 0.68
2014 1.05 0.67 0.55 1.82 1.13 0.75 0.70 0.63 0.76 0.23 0.49
2015 1.26 0.91 0.41 1.71 1.46 0.99 0.93 0.89 0.75 0.19 -0.31

area


In [6]:
hello(plot.area)
fig = plot.area(energy)


function
 Figure: Area chart of columns in a DataFrame. 

bar


In [7]:
hello(plot.bar)
fig = plot.bar(energy)


function
 Figure: Stacked bar chart of Series or DataFrame. 

hist


In [8]:
hello(plot.hist)
fig = plot.hist(temps)


function
 Figure: Histogram(s) of Series or DataFrame. 

line


In [9]:
hello(plot.line)
fig = plot.line(temps)


function
 Figure: Line plot of Series or DataFrame. 

quantile


In [10]:
hello(plot.quantile)
fig = plot.quantile(temps)


function
 Figure: Quantiles for each row of DataFrame.