property LArray.plot

Plots 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, default False

Make separate subplots for each column

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

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)

layouttuple (optional)

(rows, columns) for the layout of the plot


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 # doctest: +SKIP
>>> a = ndtest('sex=M,F;age=0..20')

Simple line plot

>>> a.plot() # doctest: +SKIP
>>> # shows figure (reset the current figure after showing it! Do not call it before savefig)
>>> # doctest: +SKIP

Line plot with grid, title and both axes in logscale

>>> a.plot(grid=True, loglog=True, title='line plot') # doctest: +SKIP
>>> # saves figure in a file (see matplotlib.pyplot.savefig documentation for more details)
>>> plt.savefig('my_file.png') # doctest: +SKIP

2 bar plots sharing the same x axis (one for males and one for females)

>>>, sharex=True) # doctest: +SKIP
>>> # doctest: +SKIP

Create a figure containing 2 x 2 graphs

>>> # see matplotlib.pyplot.subplots documentation for more details
>>> fig, ax = plt.subplots(2, 2, figsize=(15, 15)) # doctest: +SKIP
>>> # 2 curves : Males and Females
>>> a.plot(ax=ax[0, 0], title='line plot') # doctest: +SKIP
>>> # bar plot with stacked values
>>>[0, 1], stacked=True, title='stacked bar plot') # doctest: +SKIP
>>> # same as previously but with colored areas instead of bars
>>> a.plot.area(ax=ax[1, 0], title='area plot') # doctest: +SKIP
>>> # scatter plot
>>> a.plot.scatter(ax=ax[1, 1], x='M', y='F', title='scatter plot') # doctest: +SKIP
>>> # doctest: +SKIP