neuralib.plot.figure.ax_merge

neuralib.plot.figure.ax_merge(ax)[source]

Subplots Axes merge

Dimension parameters:

R = number of rows

C = number of columns

G = R * C

Example of 5x3 grid subplots

Subplot 1 ax1 (3x2)

Subplot 1 ax1 (3x2)

Subplot 4 ax4 (5x1)

Subplot 1 ax1 (3x2)

Subplot 1 ax1 (3x2)

Subplot 4 ax4 (5x1)

Subplot 1 ax1 (3x2)

Subplot 1 ax1 (3x2)

Subplot 4 ax4 (5x1)

Subplot 2 ax2 (2x1)

Subplot 3 ax3 (2x1)

Subplot 4 ax4 (5x1)

Subplot 2 ax2 (2x1)

Subplot 3 ax3 (2x1)

Subplot 4 ax4 (5x1)

>>> with plot_figure(None, 5, 3) as _ax:
...     ax1 = ax_merge(_ax)[:3, :2]
...     ax1.plot(np.arange(5), 'ro')
...     ax1.set_title('subplot 1')
...
...     ax2 = ax_merge(_ax)[3:, 1]
...     ax2.imshow(np.random.sample((10, 10)))
...     ax2.set_title('subplot 2')
...
...     ax3 = ax_merge(_ax)[3:, 2]
...     ax3.plot(np.arange(10), 'g*')
...     ax3.set_title('subplot 3')
...
...     D = np.random.normal((3, 5, 4), (0.75, 1.00, 0.75), (200, 3))
...     ax4 = ax_merge(_ax)[:, -1]
...     ax4.violinplot(D, [2, 4, 6], widths=2, showmeans=False, showmedians=False, showextrema=False)
...     ax4.set_title('subplot 4')
Parameters:

ax (ndarray) – Array[Axes, G]

Returns:

AxesMergeHelper

Return type:

AxesMergeHelper