Skip to content

0.42.0 — size by the subplot, not the figure

Choose a tag to compare

@jrvannucci jrvannucci released this 20 Sep 23:46
· 22 commits to main since this release

Added

  • subplot_size= on subplots()/subplots_from_groups() -- give the size
    of one subplot in inches and have figsize solved for it, instead of sizing
    the whole figure and discovering what that left each panel::

    fig, axes = plotpress.subplots(20, 25, subplot_size=(1.2, 0.9))
    

    A readable panel is a fixed size, so on a large grid what a caller knows is
    how big one panel should be -- not what 500 of them plus their tick labels,
    titles, colorbars, group boxes and supxlabel add up to.
    figsize=(ncols * 1.2, nrows * 0.9) is the usual guess and is always wrong,
    because none of that surrounding furniture scales with the grid the way the
    panels do. The room it needs is measured and added on top, so the panels come
    out the size asked for. tight_layout() does the solving, so the answer
    reflects the labels actually set rather than a guess made before they
    existed. A colorbar, a group box or a suptitle grows the figure rather than
    eating into the panels -- subplot_size is the size of the plotting box,
    not of the grid cell the colorbar is carved out of.

Fixed

  • The global slider bar could grow off the top of the window. "Link all
    matching axes" makes one global slider per compatible group, so a figure
    whose meshes come in many different grid shapes stacks many of them in the
    bar fixed to the bottom of the window. Nothing bounded that column: 24 groups
    made a 1319px bar in a 900px viewport, and since a position: fixed element
    does not scroll with the page, the eight sliders above the top edge could not
    be reached at all. The bar is now capped to the room it actually has and
    scrolls inside itself, and re-caps when the window resizes.

Documentation

  • A worked example for subplot_size=, which opens by multiplying out a
    figsize the obvious way and printing what the panels actually came to
    (1.00 x 0.45in where 1.40 x 1.10 was intended), then states the same
    requirement with subplot_size= and holds it across three grid sizes and a
    per-axes colorbar. The 500-panel grouped demo and the 500-panel scale example
    now use it too -- both were hand-multiplying figsize=(NCOLS * 1.6, NROWS * 1.6), the pattern this replaces, and neither was getting the panel
    size it named.