Plotting¶
Import the LArray library:
[2]:
from larray import *
Check the version of LArray:
[3]:
from larray import __version__
__version__
[3]:
'0.31'
Import a subset of the test array pop
:
[4]:
# import a 6 x 2 x 2 subset of the 'pop' example array
pop = load_example_data('demography').pop[2016, 'BruCap', 90:95]
pop
[4]:
age sex\nat BE FO
90 M 539 74
90 F 1477 136
91 M 499 49
91 F 1298 105
92 M 332 35
92 F 1141 78
93 M 287 27
93 F 906 74
94 M 237 23
94 F 739 65
95 M 154 19
95 F 566 53
Inline matplotlib:
[5]:
%matplotlib inline
Create a plot (last axis define the different curves to draw):
[6]:
pop.plot()
[6]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f6b978f05f8>
[7]:
# plot total of both sex
pop.sum('sex').plot()
[7]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f6b957bc438>