Repository navigation
FEA: Add bar charts, stairs, histograms, cells and occupancy matrices - #173
Merged
Merged
Conversation
…162) * FEA: Add bar, stairs and cells artists and axis visibility to the IR Add the Bar, Stairs and Cells artist variants, with their orientation, base, slot, gap, group, edge and colour-scale properties, and add the visible and tick_label_angle properties to Axis. Encode them on the wire, register their edit paths and choices, validate their shapes, gaps, edges, groups and logarithmic axes, and document them in the figure schema reference. The scene compiler skips the new artists with a warning until later stages draw them. * ENH: Colour bars through colour data and give artists edge opacities Replace the per-bar colour list with colour data and a colour scale of any kind, as series have, so that a colormapped face or edge takes each bar's colour. Give bars a black edge and an edge opacity by default, give stairs a line opacity, and replace the single opacity of cells with face and edge opacities.
Draw no spine, ticks, tick labels, exponent or label for a hidden axis and give its space to the plot area, keeping its grid lines. Turn tick labels by their axis's angle about the end nearest the tick, reserve the turned extents in the layout and keep every label clear of the plot. Add the facade setters for both properties and document them.
Draw bars with their slots, gaps, bases, groups and stacks, colour order, colour data and edges, and stairs with open or based outlines, fills and step positions. Give both tight category limits, legend samples, bar and step hits and datatips that name their categories. Add bar, barh, stairs and stairs_at to the facade, with per-bar colours built from an indexed colour scale, and document them.
Draw cells between their edges with gaps measured on the page, coloured through their scale with alpha and opacities, and give them tight limits, legend sweeps, hits and datatips that name their row and column categories. Add cells, occupancy and the x and y category helpers, including grouped rows under bold headers, and set \textbf arguments in the bundled bold face. Share rectangle and category code with bars.
Place each bar by its own position, offset, width and base, with its value as a length from the base and a margin beyond its end in the automatic limits, and remove bar groups, slots and gaps from the model. Add the bars helper, which writes the offsets, widths and bases of grouped and stacked series. Store the bin definition of a histogram on its bars, stairs or cells so that datatips report each bin's count and density. Record the decisions in ADRs 0026 to 0029.
* FEA: Add histogram binning rules and normalisations Add the binning module with numpy's bin rules and edge semantics, MATLAB's integers rule and normalisations, weights, explicit ranges and a summary of excluded samples, in one and two dimensions. * FEA: Add histograms, 2D histograms and density contours Add hist, hists, hist_counts, hist2d and density_contour to the facade. Bin samples with the binning module, which now takes the bin types of the model, and store bars, stairs or cells with a record of how they were binned, including the resolved bin edges, so that datatips read the count and density of a whole bin. Share the placement of grouped and stacked columns between the bars and hists helpers.
Add seven gallery figures: grouped bars, four bar variants, stairs, histograms, a 2D histogram with density contours, a branch coverage map and a case coverage matrix. Require the chart types in the coverage test, refuse layout warnings in the registry test, and link the guides and references to the new figures.
Release the bars and histograms epic as version 0.16.0. The schema moves to version 0.8.0 because it adds the bar, stairs and cells artists, the binning records of the histograms they draw, and the visibility and tick label angle of an axis, none of which a reader of version 0.7 can interpret.
This was referenced Oct 26, 2026
Closed
Normalise the members of a stacked column of `hists` by the pooled total of the column, so that the top of the stack is the normalised histogram of the pooled sample and each layer is its member's share of it, as Matplotlib's `hist(stacked=True, density=True)` and seaborn's default `common_norm=True` do. Members in columns of their own are still normalised by their own totals. Add `HistsMut::common_norm(bool)`, which normalises every member by the pooled total of all the members, or each by its own, whatever the layout. Record in each member's `Binning.total` the total its values were normalised by, so that a datatip recovers the member's own count.
Tag the new gallery figures with the words a reader searches for, such as stacked, grouped, histogram, 2d-histogram, density, tick-angle and occupancy, replace the physics tag with the field each figure comes from, and pin the searches in the browsing tests.
A bar is now 0.55 of the pitch wide by default rather than 0.8, which gives a lighter default chart. The default gap between the clusters of the bars helper becomes 0.45 to match, so that a lone series of the helper is drawn exactly as bar draws it. Histograms are unchanged, because they place their bars on the widths of their bins.
…168) Automatic contour levels were always spaced linearly, so a field spanning several decades seen through a colour scale with a logarithmic norm had all its isolines in its top decade, in nearly one colour. Under a logarithmic norm, automatic levels are now chosen strictly inside the range of the positive values of the field, as Matplotlib's LogLocator places them: the decades, thinned to at most the requested count; failing two decades, 1, 2 and 5 times each decade; then 1 to 9 times each decade; then linear levels. A filled band under a logarithmic norm is coloured by its geometric middle, so that its colour matches the middle of its span on the bar. Band edges supplied by a discrete scale are unaffected. Closes #167
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This promotes the bars and histograms epic to
mainas version 0.16.0, with schema version 0.8.0.New chart types
barshelper writes grouped and stacked series, including stacks side by side.hist,hists(stacked or grouped on shared bins),hist_counts,hist2danddensity_contour.occupancyhelper builds the matrix and hides its x axis.\textbfis now supported in text.Axes
Supporting changes
Automatic contour levels on a logarithmic colour scale are also spaced logarithmically now (#167), a fix included in this release.
Closes #92
Closes #93
Closes #94
Closes #99
Closes #153
Closes #74
Closes #167