Skip to content

anytrellis 0.6.0

Latest

Choose a tag to compare

@github-actions github-actions released this 17 Nov 22:37

Changed

  • A new default look, theme="minimal": panels without a fill, the grid as the text
    colour at 10% opacity and only across y (across x too for points, or when y is a band),
    an x baseline and no y axis line, strips as left-aligned semibold titles with nothing
    behind them, the y title level over the plot (↑ temp), a grid's row labels level at the
    right as wide as they need, no x title on a time axis unless given, and Petroff's
    colour-vision-tested palette (petroff10) in place of tab10. A paged wrap's strip keeps
    the panel's name whole and shows the sorted value in lighter type. theme="classic"
    keeps the look before (Upgrading); images saved from
    Python (save_svg, save_png) draw both looks the same as the browser.
  • The toolbar explains itself. What a drag does is one control of three, pan, box zoom
    and select, with the one on filled; they were two toggles that left pan implied. The
    icons are in the muted colour at full opacity (over 3:1 on the background), the text
    colour on hover and focus, where they were faded to 45% and looked disabled. Chips beside
    the toolbar say what differs from the start, "Zoomed in x", "267 of 693 marks selected",
    "2 filters: 12 of 40 panels", each with its Reset or Clear (the count of a brush released
    is no longer a passing notice). ? or the new ? button shows the keys and mouse,
    the renderer and the anytrellis version; the renderer's name no longer appears in the
    plot's corner on hover.
  • Time axes take the nearest calendar step, as d3 does, not the next larger one, and
    never fewer than two ticks: a week of data in a narrow panel is labelled every two days,
    where it showed a single date; a year at six ticks is labelled every two months.
  • Category labels too long to sit side by side wrap onto two lines, or failing that are
    set at 45 degrees
    (cut at 90 px), instead of being thinned out: every variety of the
    barley data now shows under its bar, where two of ten did. The x axis grows to hold them,
    in the browser and in save_svg / save_png.
  • Panels with an aspect (banked or a number) keep their shape in full screen, in an
    opened panel and in an image of a given height: as large as fits, narrower and centred
    when the height is too low for the whole width. An opened panel is then at most 85% of
    the window high (720 px in an image), and at least 320 px. Before, the height given
    overrode the shape. Plots without an aspect are unchanged.

Added

  • Bars along y: bars(x="units", y="product"), with a category y and x not, draws
    the bars from zero along x, stacked or dodged as upright ones are.
  • position="fill" on bars(), area() and hist(): each stack as shares of its
    total, up to 1, on an axis written in percent.
  • points(jitter=): points spread across their category's band, up to that fraction
    of its width, each row in the same place every time it is drawn.
  • Rules from data: rule(targets, y="target") draws a line per row of a table, in the
    panel of its facet columns' values (or every panel, without them).
  • colormap() for number colour columns: "viridis" (the default), "cividis",
    "magma", "Blues", "RdBu" and "PuOr", each reversed with "_r", or a list of
    colours; and how the values take it, scale=: "linear", "diverging" (as deep on
    both sides of midpoint=, RdBu with red high by default), "binned" (about bins=
    steps of round width) or "quantile" (bins= steps of as many values each). A stepped
    scale's legend lists its ranges ("10–20"), written by format(color=) when given.
  • palette="okabe-ito" (Okabe and Ito's eight colours), and palette= as a dict,
    {"USA": "#d62728"}: those categories keep their colours in every plot, the others take
    the palette's colours that are left.
  • limits(x=, y=): an axis's range, either end None for the data's own
    (limits(y=(0, None))); times as dates, log axes in their values. Zooming starts there
    and Reset returns there.
  • format(x=, y=, color=): d3-format strings for numbers (",.0f", ".1%", ".2s",
    "$,.2f") and strftime strings for times ("%b %Y"), for tick labels, tooltips and a
    colour legend's ends, in the page and in save_svg / save_png alike. Both sides are
    checked against d3's own output.
  • legend(position, title=): "right" (a column right of the plot) and "none"
    join "auto" and "bottom", also as Trellis(legend=); title= renames the legend.
  • subtitle= and caption= on Trellis and pairs: a line or two under the title,
    and a note under the plot (a source, a footnote). Both wrap, and both are in exported
    images, from the page and from save_svg / save_png.
  • labels=, one dictionary naming columns for readers ({"mpg": "Fuel use (mpg)"}):
    used for axis titles, the legend's title, tooltips, a page column's title, the sort and
    filter menus, and a pairs plot's strips. Code still names columns as they are.
  • Trellis(theme=): "minimal", "framed" or "classic", also on pairs(). framed,
    after Observable Plot, draws a thin frame around each panel, 10 px between them, strips
    centred, the x title at its axis' end (weight →) and d3's observable10 palette.
  • anytrellis.Theme("minimal", frame=True, panel_gap=12, ...): a named theme with any of
    its settings changed (panel fill, frame, grid direction and opacity, axis lines, strip
    fill, alignment and weight, where the axis titles go, row labels level or on their side,
    the gap between panels, the palette). anytrellis.set_theme() sets the session's
    default; get_theme() reads it.
  • palette= takes a name: "petroff10", "petroff8", "petroff6", "observable10" or
    "tab10".
  • Trellis(aspect="bank"): the panels' shape that shows the median slope of the lines'
    segments at 45 degrees, each measured in its own panel's ranges (Cleveland's banking):
    the smooth() fits' (a trend, not the noise around it), or without them the line()
    layers'. Between 0.02 and 5 times as
    high as wide; with load="pages", kept from the panels read first.
  • horizon(x, y, bands=3, origin=0, step=None): a horizon chart in each panel. A series'
    distance from origin is cut into bands of one height, laid over each other and darker
    the farther, blues above the origin and reds below it, so a series shows its highs and
    lows in a panel 24 px high. Every panel shares the band height (by default a round
    number reaching the farthest value of any panel); the legend names each band's range,
    and clicking it selects the times a series reaches it. Works with load="pages";
    margins are left empty.
  • Trellis(margins=): a grid's "(all)" panels, as ggplot2's facet_grid(margins = TRUE).
    True adds an (all) row under the rows (each panel the rows of its column) and an (all)
    column right of the columns (each panel the rows of its row), with a corner of every
    row; "row" or "col" adds one. Every layer draws them, summaries computed from their
    rows; a row selected in a margin is selected once. With empty="blank" and page=;
    not with load="pages" or a wrap.
  • share_x="sliced" / share_y="sliced" (also in share()): each panel its own range,
    about its own data, every one as wide as the widest, so a change of 5 looks the same size
    in every panel (lattice's relation="sliced"). Zooming one panel zooms all to its width,
    each about its own centre; panning moves one; fitting y keeps them as wide. Bars keep
    their base at 0. With load="pages", the widths come from every panel's range in the
    database. Not on an axis of categories.

Fixed

  • Lines, areas and bands drawn in other panels than their own (a margin's, or with
    facet="all" or "exclude") no longer join the rows of several panels into one line
    zigzagging between them: each panel's rows stay a line of their own.