property Array.plot: PlotObject

Plot the data of the array into a graph (window pop-up).

The graph can be tweaked to achieve the desired formatting and can be saved to a .png file.

  • ‘line’ : line plot (default)

  • ‘bar’ : vertical bar plot

  • ‘barh’ : horizontal bar plot

  • ‘hist’ : histogram

  • ‘box’ : boxplot

  • ‘kde’ : Kernel Density Estimation plot

  • ‘density’ : same as ‘kde’

  • ‘area’ : area plot

  • ‘pie’ : pie plot

  • ‘scatter’ : scatter plot (if array’s dimensions >= 2)

  • ‘hexbin’ : hexbin plot (if array’s dimensions >= 2)

axmatplotlib axes object, default None
subplotsboolean, Axis, int, str or tuple, default False

Make several subplots. If True, will make subplots for each combination of labels for all axes except the last. If an Axis, int, str (or tuple of those), it will make subplots for combination of labels of those axes.

sharexboolean, default True if ax is None else False

In case subplots=True, share x axis and set some x axis labels to invisible; defaults to True if ax is None otherwise False if an ax is passed in; Be aware, that passing in both an ax and sharex=True will alter all x axis labels for all axis in a figure!

shareyboolean, default False

In case subplots=True, share y axis and set some y axis labels to invisible

layouttuple (optional)

(rows, columns) for the layout of subplots

figsizea tuple (width, height) in inches
use_indexboolean, default True

Use index as ticks for x axis


Title to use for the plot

gridboolean, default None (matlab style default)

Axis grid lines


Place legend on axis subplots. Defaults to True.

stylelist or dict

matplotlib line style per column

logxboolean, default False

Use log scaling on x axis

logyboolean, default False

Use log scaling on y axis

loglogboolean, default False

Use log scaling on both x and y axes


Values to use for the xticks


Values to use for the yticks

rotint, default None

Rotation for ticks (xticks for vertical, yticks for horizontal plots)

fontsizeint, default None

Font size for xticks and yticks

colormapstr or matplotlib colormap object, default None

Colormap to select colors from. If string, load colormap with that name from matplotlib.

colorbarboolean, optional

If True, plot colorbar (only relevant for ‘scatter’ and ‘hexbin’ plots)


Specify relative alignments for bar plot layout. From 0 (left/bottom-end) to 1 (right/top-end). Default is 0.5 (center)


Error bars on y axis


Error bars on x axis

stackedboolean, default False in line and bar plots, and True in area plot.

If True, create stacked plot.


Options to pass to matplotlib plotting method

axesmatplotlib.AxesSubplot or np.array of them


See Pandas documentation of plot function for more details on this subject


>>> import matplotlib.pyplot as plt
>>> # let us define an array with some made up data
>>> arr = Array([[5, 20, 5, 10], [6, 16, 8, 11]], 'gender=M,F;year=2018..2021')

Simple line plot

>>> arr.plot()
>>> # show figure (it also resets it after showing it! Do not call it before savefig)

Line plot with grid and a title

>>> arr.plot(grid=True, title='line plot')
>>> # save figure in a file (see matplotlib.pyplot.savefig documentation for more details)
>>> plt.savefig('my_file.png')

2 bar plots (one for each gender) sharing the same y axis, which makes sub plots easier to compare. By default sub plots are independant of each other and the axes ranges are computed to “fit” just the data for their individual plot.

>>>'gender', sharey=True)

Create a figure containing 2 x 2 graphs

>>> # see matplotlib.pyplot.subplots documentation for more details
>>> fig, ax = plt.subplots(2, 2, figsize=(10, 8), tight_layout=True)   
>>> # line plot with 2 curves (Males and Females) in the top left corner (0, 0)
>>> arr.plot(ax=ax[0, 0], title='line plot')                           
>>> # bar plot with stacked values in the top right corner (0, 1)
>>>[0, 1], stacked=True, title='stacked bar plot')  
>>> # area plot in the bottom left corner (1, 0)
>>> arr.plot.area(ax=ax[1, 0], title='area plot')                      
>>> # scatter plot in the bottom right corner (1, 1), using the year as color
>>> # index and a specific colormap
>>> arr.plot.scatter(ax=ax[1, 1], x='M', y='F', c=arr.year, colormap='viridis',
...                  title='scatter plot')