<jupyter_start><jupyter_text>Insets and panels  Panel axes<jupyter_code>Often, it can be useful to have narrow "panels" along the edge of a larger subplot for plotting secondary 1-dimensional datasets or summary statistics. In matplotlib, this requires a lot of work. In ProPlot, you can create "panels" by passing a location (e.g. ``'r'`` or ``'right'``) to the `~proplot.axes.Axes.panel` or `~proplot.axes.Axes.panel_axes` methods. The resulting axes are instances of `~proplot.axes.XYAxes`.

To generate "stacked" panels, simply call `~proplot.axes.Axes.panel` or `~proplot.axes.Axes.panel_axes` more than once. To include panels when centering spanning axis labels and super titles, pass ``includepanels=True`` to `~proplot.subplots.Figure`. Panels do not interfere the tight layout algorithm and do not affect the aspect ratios of subplots (see :ref:`Subplots features` for details). In the first example, the panel separation from the main subplot is manually set to ``space=0``. In the second example, it is adjusted automatically by the tight layout algorithm.<jupyter_output><empty_output><jupyter_text>import proplot as plotimport numpy as npstate = np.random.RandomState(51423)data = (state.rand(20, 20) - 0.48).cumsum(axis=1).cumsum(axis=0)data = 10 * (data - data.min()) / (data.max() - data.min()) Stacked panels with outer colorbarsfor loc_cbar, loc_panel in ('rb', 'br'):    f, axs = plot.subplots(        axwidth=1.6, nrows=1, ncols=2,        share=0, panelpad=0.1, includepanels=True    )    axs.contourf(        data, cmap='glacial', extend='both',        colorbar=loc_cbar, colorbar_kw={'label': 'colorbar'},    )         Summary statistics and settings    x1 = x2 = np.arange(20)    y1 = data.mean(axis=int(loc_panel == 'r'))    y2 = data.std(axis=int(loc_panel == 'r'))    titleloc = 'upper center'    if loc_panel == 'r':        titleloc = 'center'        x1, x2, y1, y2 = y1, y2, x1, x2    space = 0    width = '30pt'    kwargs = {'xreverse': False, 'yreverse': False, 'titleloc': titleloc}         Panels for plotting the mean    paxs1 = axs.panel(loc_panel, space=space, width=width)    paxs1.plot(x1, y1, color='gray7')    paxs1.format(title='Mean', **kwargs)         Panels for plotting the standard deviation    paxs2 = axs.panel(loc_panel, space=space, width=width)    paxs2.plot(x2, y2, color='gray7', ls='--')    paxs2.format(title='Stdev', **kwargs)         Apply formatting *after*    axs.format(        xlabel='xlabel', ylabel='ylabel', title='Title',        suptitle='Using panels for summary statistics',    ) import proplot as plotf, axs = plot.subplots(axwidth=1.5, nrows=2, ncols=2, share=0) Panels do not interfere with subplot layoutfor ax, side in zip(axs, 'tlbr'):    ax.panel_axes(side, width='3em')axs.format(    title='Title', suptitle='Complex arrangement of panels', collabels=['Column 1', 'Column 2'],    abcloc='ul', titleloc='uc', xlabel='xlabel', ylabel='ylabel', abc=True, abovetop=False)axs.format(    xlim=(0, 1), ylim=(0, 1),    ylocator=plot.arange(0.2, 0.8, 0.2),    xlocator=plot.arange(0.2, 0.8, 0.2))<jupyter_code>## Inset axes<jupyter_output><empty_output><jupyter_text>`Inset axes `__ can be generated with the `~proplot.axes.Axes.inset` or `~proplot.axes.Axes.inset_axes` command. The resulting axes are instances of `~proplot.axes.XYAxes`, and therefore can be modified with the `~proplot.axes.XYAxes.format` command.Passing ``zoom=True`` to `~proplot.axes.Axes.inset` draws "zoom indication" lines with `~matplotlib.axes.Axes.indicate_inset_zoom`, and ProPlot *automatically updates* the lines when the axis limits of the parent axes change. To modify the line properties, simply use the `zoom_kw` argument.<jupyter_code>import proplot as plot
import numpy as np
N = 20
# Inset axes representing a "zoom"
state = np.random.RandomState(51423)
f, ax = plot.subplots(axwidth=3)
x, y = np.arange(10), np.arange(10)
data = state.rand(10, 10)
m = ax.pcolormesh(data, cmap='Grays', levels=N)
ax.colorbar(m, loc='b', label='label')
ax.format(xlabel='xlabel', ylabel='ylabel')
axi = ax.inset(
    [5, 5, 4, 4], transform='data', zoom=True,
    zoom_kw={'color': 'red3', 'lw': 2}
)
axi.format(
    xlim=(2, 4), ylim=(2, 4), color='red7',
    linewidth=1.5, ticklabelweight='bold'
)
axi.pcolormesh(data, cmap='Grays', levels=N)
ax.format(suptitle='"Zooming in" with an inset axes')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14380581634989695, 'fraction_numerical': 0.0245019464163041, 'mean_word_length': 4.702349869451697, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '149014', 'license': 'MIT', 'n_tokens_mistral': 1602, 'n_tokens_neox': 1503, 'n_words': 438, 'path': 'docs/insets_panels.ipynb', 'repo_name': 'briochemc/proplot', 'size': '4367'}