Skip to content

Commit

Permalink
Update README, CHANGELOG
Browse files Browse the repository at this point in the history
  • Loading branch information
mbostock committed May 31, 2022
1 parent 949f9b5 commit e3eb4c6
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 11 deletions.
28 changes: 18 additions & 10 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,37 @@

*Not yet released. These are forthcoming changes in the main branch.*

Mark initializers with the **initializer** option! Plot.initializer for creating custom initializers. [breaking] *mark*.initialize return signature.
Plot now supports mark initializers via the **initializer** option; these can be used to transform or derive new channels. Unlike data transforms which operate in abstract data space, initializers can operate in screen space such as pixel coordinates and colors. For example, initializers can modify a marks’ positions to avoid occlusion. The new hexbin and dodge transforms are implemented as mark initializers.

Hexbin transform. Hexgrid, circle, and hexagon marks. Mark channels can define a radius hint to set the upper bound of the default range of the *r* scale.
The new hexbin transform functions similarly to the bin transform, except it aggregates both *x* and *y* into hexagonal bins before reducing. The size of the hexagons can be specified with the **binWidth** option, which controls the width of the (pointy-topped) hexagons.

Dodge transform.
The new hexgrid decoration mark draws a hexagonal grid. It is intended to be used with the hexbin transform as an alternative to the default horizontal and vertical axis grid.

[breaking] Color scales with diverging color schemes now default to the *diverging* scale type instead of the *linear* scale type.
The dot mark now supports the *hexagon* symbol type for pointy-topped hexagons. The new circle and hexagon marks are convenience shorthand for dot marks with the *circle* and *hexagon* symbol, respectively. The dotX, dotY, textX, and textY marks now support the **interval** option.

The new dodge transform can be used to produce beeswarm plots. Given an *x* channel representing the desired horizontal position of circles, the dodgeY transform derives a new *y* (vertical position) channel such that the circles do not overlap; the dodgeX transform similarly derives a new *x* channel given a *y* channel. If an *r* channel is specified, the circles may have varying radius.

The **sort** option now supports index sorting.
The mark **sort** option now supports index sorting. For example, to sort dots by ascending radius:

~~~js
Plot.dot(earthquakes, {x: "longitude", y: "latitude", r: "intensity", sort: {channel: "r", reverse: true}})
Plot.dot(earthquakes, {x: "longitude", y: "latitude", r: "intensity", sort: {channel: "r"}})
~~~

The dot mark now sorts by descending radius by default to reduce occlusion.

The dotX, dotY, textX, and textY marks now support the **interval** option.

Fix crash when using area shorthand (no options).
The **zero** scale option (like the **nice** and **clamp** options) may now be specified as a top-level option, applying to all quantitative scales.

The rule mark now correctly respects the **dx** and **dy** options.

Improve performance of internal array operations and type coercion.
Fix crash when using area mark shorthand.

Marks can now define a channel hint to set the default range of the *r* scale. This is used by the hexbin transform when producing an *r* output channel.

Improve performance of internal array operations, including type coercion.

[breaking] Color scales with diverging color schemes now default to the *diverging* scale type instead of the *linear* scale type.

[breaking] *mark*.initialize return signature.

## 0.4.3

Expand Down
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1025,7 +1025,7 @@ The **r** option can be specified as either a channel or constant. When the radi
The **stroke** defaults to none. The **fill** defaults to currentColor if the stroke is none, and to none otherwise. The **strokeWidth** defaults to 1.5. The **rotate** and **symbol** options can be specified as either channels or constants. When rotate is specified as a number, it is interpreted as a constant; otherwise it is interpreted as a channel. When symbol is a valid symbol name or symbol object (implementing the draw method), it is interpreted as a constant; otherwise it is interpreted as a channel.
The built-in **symbol** types are: *circle*, *cross*, *diamond*, *square*, *star*, *triangle*, and *wye* (for fill) and *circle*, *plus*, *times*, *triangle2*, *asterisk*, *square2*, and *diamond2* (for stroke, based on [Heman Robinson’s research](https://www.tandfonline.com/doi/abs/10.1080/10618600.2019.1637746)). You can also specify a D3 or custom symbol type as an object that implements the [*symbol*.draw(*context*, *size*)](https://github.com/d3/d3-shape/blob/main/README.md#custom-symbol-types) method.
The built-in **symbol** types are: *circle*, *cross*, *diamond*, *square*, *star*, *triangle*, and *wye* (for fill) and *circle*, *plus*, *times*, *triangle2*, *asterisk*, *square2*, and *diamond2* (for stroke, based on [Heman Robinson’s research](https://www.tandfonline.com/doi/abs/10.1080/10618600.2019.1637746)). The *hexagon* symbol is also supported. You can also specify a D3 or custom symbol type as an object that implements the [*symbol*.draw(*context*, *size*)](https://github.com/d3/d3-shape/blob/main/README.md#custom-symbol-types) method.
Dots are drawn in input order, with the last data drawn on top. If sorting is needed, say to mitigate overplotting by drawing the smallest dots on top, consider a [sort and reverse transform](#transforms).
Expand Down Expand Up @@ -1057,6 +1057,14 @@ Equivalent to [Plot.dot](#plotdotdata-options) except that if the **y** option i
If an **interval** is specified, such as d3.utcDay, **x** is transformed to (*interval*.floor(*x*) + *interval*.offset(*interval*.floor(*x*))) / 2. If the interval is specified as a number *n*, *x* will be the midpoint of two consecutive multiples of *n* that bracket *x*.
#### Plot.circle(*data*, *options*)
Equivalent to [Plot.dot](#plotdotdata-options) except that the **symbol** option is set to *circle*.
#### Plot.hexagon(*data*, *options*)
Equivalent to [Plot.dot](#plotdotdata-options) except that the **symbol** option is set to *hexagon*.
### Hexgrid
The hexgrid mark can be used to support marks using the [hexbin](#hexbin) layout.
Expand Down

0 comments on commit e3eb4c6

Please sign in to comment.