Skip to content

Commit 5478728

Browse files
mbostockFil
andauthored
0.6.16 (#2122)
* checkpoint changelog * update changelog * fix image widths * more changelog * more changelog * more changelog * more changelog * upgrade dependencies * Update CHANGELOG.md --------- Co-authored-by: Philippe Rivière <[email protected]>
1 parent 9ea2e27 commit 5478728

23 files changed

+461
-358
lines changed

CHANGELOG.md

+107
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,113 @@
22

33
Year: **Current (2024)** · [2023](./CHANGELOG-2023.md) · [2022](./CHANGELOG-2022.md) · [2021](./CHANGELOG-2021.md)
44

5+
## 0.6.16
6+
7+
[Released August 6, 2024.](https://github.com/observablehq/plot/releases/tag/v0.6.16)
8+
9+
The new [waffle mark](https://observablehq.com/plot/marks/waffle) 🧇 displays a quantity (or quantitative extent) for a given category; unlike a [bar](https://observablehq.com/plot/marks/bar), a waffle is subdivided into cells that allow easier counting, making waffles useful for reading and comparing exact quantities. Plot’s waffle mark is highly configurable: it supports stacking, positive and negative values, rounded corners, partial cells for fractional counts, automatic row or column size determination (with optional override), and more!
10+
11+
[<img src="./img/waffle.png" width="708" alt="a waffle chart of Olympic athletes by weight">](https://observablehq.com/plot/marks/waffle)
12+
13+
```js
14+
Plot.plot({
15+
fx: {interval: 10},
16+
color: {legend: true},
17+
marks: [Plot.waffleY(olympians, Plot.groupZ({y: "count"}, {fill: "sex", sort: "sex", fx: "weight", unit: 10}))]
18+
})
19+
```
20+
21+
22+
All marks now support GeoJSON data and GeoJSON property shorthand, making it easier to work with GeoJSON. For example, below the data `counties` is a GeoJSON FeatureCollection, and `unemployment` refers to a property on each feature; the **fill** option is thus shorthand for `(d) => d.properties.unemployment`. The [geo mark](https://observablehq.com/plot/marks/geo) now also supports the **tip** option (via an implicit [centroid transform](https://observablehq.com/plot/transforms/centroid)), making it easier to use Plot’s [interactive tooltips](https://observablehq.com/plot/interactions/pointer).
23+
24+
[<img src="./img/geo-tip.png" width="708" alt="a choropleth map of unemployment by U.S. county">](https://observablehq.com/plot/marks/geo)
25+
26+
```js
27+
Plot.plot({
28+
projection: "albers-usa",
29+
color: {
30+
type: "quantile",
31+
n: 9,
32+
scheme: "blues",
33+
label: "Unemployment (%)",
34+
legend: true
35+
},
36+
marks: [
37+
Plot.geo(counties, {
38+
fill: "unemployment",
39+
title: (d) => `${d.properties.name} ${d.properties.unemployment}%`,
40+
tip: true
41+
})
42+
]
43+
})
44+
```
45+
46+
All marks now also support column name channel shorthand when using Apache Arrow tables as data, and we’ve added detection of Arrow date-type columns. (Arrow represents temporal data using BigInt rather than Date.)
47+
48+
```js
49+
Plot.dot(gistemp, {x: "Date", y: "Anomaly"}).plot() // gistemp is an Arrow Table!
50+
```
51+
52+
The rect-like marks ([rect](https://observablehq.com/plot/marks/rect), [bar](https://observablehq.com/plot/marks/bar), [cell](https://observablehq.com/plot/marks/cell), and [frame](https://observablehq.com/plot/marks/frame)) now support individual rounding options for each side (**rx1**, **ry1**, *etc.*) and corner (**rx1y1**, **rx2y1**, *etc.*). This allows you to round just the top side of rects. You can even use a negative corner radius on the bottom side for seamless stacking, as in the histogram of Olympic athletes below.
53+
54+
[<img src="./img/rect-rounded.png" width="708" alt="a histogram of Olympic athletes by weight">](https://observablehq.com/plot/marks/rect)
55+
56+
```js
57+
Plot.plot({
58+
color: {legend: true},
59+
marks: [
60+
Plot.rectY(olympians, Plot.binX({y: "count"}, {x: "weight", fill: "sex", ry2: 4, ry1: -4, clip: "frame"})),
61+
Plot.ruleY([0])
62+
]
63+
})
64+
```
65+
66+
Plot now respects the projection **domain** when determining the default plot height. Previously, the map below would use a default square aspect ratio for the *conic-conformal* projection regardless of the specified **domain**, but now the map is perfectly sized to fit North Carolina. (Plot also now chooses a smarter default plot height when the ordinal *y* scale domain is empty.)
67+
68+
<img src="./img/geo-nc.png" width="659" alt="an unlabeled map showing the outline and counties of North Carolina">
69+
70+
```js
71+
Plot.plot({
72+
projection: {.
73+
type: "conic-conformal",
74+
parallels: [34 + 20 / 60, 36 + 10 / 60],
75+
rotate: [79, 0],
76+
domain: state
77+
},
78+
marks: [
79+
Plot.geo(counties, {strokeOpacity: 0.2}),
80+
Plot.geo(state)
81+
]
82+
})
83+
```
84+
85+
The [marker options](https://observablehq.com/plot/features/markers) now render as intended on marks with varying aesthetics, such as the spiraling arrows of varying thickness and color below.
86+
87+
<img src="./img/group-marker.png" width="659" alt="several spiraling lines emanate from the center of the image, with rainbow color and increasing thickness, each capped with a pointed arrow at the end">
88+
89+
```js
90+
Plot.plot({
91+
inset: 40,
92+
axis: null,
93+
marks: [
94+
Plot.line(d3.range(400), {
95+
x: (i) => i * Math.sin(i / 100 + ((i % 5) * 2 * Math.PI) / 5),
96+
y: (i) => i * Math.cos(i / 100 + ((i % 5) * 2 * Math.PI) / 5),
97+
z: (i) => i % 5,
98+
stroke: (i) => -i,
99+
strokeWidth: (i) => i ** 1.1 / 100,
100+
markerEnd: "arrow"
101+
})
102+
]
103+
})
104+
```
105+
106+
This release includes a few more new features, bug fixes, and improvements:
107+
108+
The new **className** [mark option](https://observablehq.com/plot/features/marks#mark-options) specifies an optional `class` attribute for rendered marks, allowing styling of marks via external stylesheets or easier selection via JavaScript; thanks, @RLesser! Plot now reuses `clipPath` elements, when possible, when the **clip** mark option is set to *frame* or *projection*.
109+
110+
The [difference mark](https://observablehq.com/plot/marks/difference) now supports a horizontal orientation via [differenceX](https://observablehq.com/plot/marks/difference#differenceX), and the [shift transform](https://observablehq.com/plot/transforms/shift) now likewise supports [shiftY](https://observablehq.com/plot/transforms/shift#shiftY). The [Voronoi mark](https://observablehq.com/plot/marks/delaunay) is now compatible with the pointer transform: only the pointed Voronoi cell is rendered; the Voronoi mark now also renders as intended with non-exclusive facets (as when using the *exclude* facet mode). The [tip mark](https://observablehq.com/plot/marks/tip) no longer displays channels containing literal color values by default.
111+
5112
## 0.6.15
6113

7114
[Released June 11, 2024.](https://github.com/observablehq/plot/releases/tag/v0.6.15)

docs/features/marks.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ linedata = [
220220
```
221221

222222
:::tip
223-
For larger datasets, you can more efficiently pass data using an [Apache Arrow](https://arrow.apache.org/docs/js/) table as a columnar data representation. <VersionBadge pr="2115" />
223+
For larger datasets, you can more efficiently pass data using an [Apache Arrow](https://arrow.apache.org/docs/js/) table as a columnar data representation. <VersionBadge version="0.6.16" pr="2115" />
224224
:::
225225

226226
Then you can pass the data to the line mark, and extract named columns from the data for the desired options:
@@ -243,7 +243,7 @@ Plot.lineY(linedata, {
243243
```
244244
:::
245245

246-
For greater efficiency, Plot also supports columnar data: you can use an [Apache Arrow](https://arrow.apache.org/docs/js/) table as data instead of an array of objects. <VersionBadge pr="2115" /> You can even pass parallel arrays of values, or Apache Arrow vectors, to each channel.
246+
For greater efficiency, Plot also supports columnar data: you can use an [Apache Arrow](https://arrow.apache.org/docs/js/) table as data instead of an array of objects. <VersionBadge version="0.6.16" pr="2115" /> You can even pass parallel arrays of values, or Apache Arrow vectors, to each channel.
247247

248248
```js
249249
Plot.lineY({length: linedata.length}, {
@@ -486,7 +486,7 @@ All marks support the following style options:
486486
* **dx** - horizontal offset (in pixels; defaults to 0)
487487
* **dy** - vertical offset (in pixels; defaults to 0)
488488
* **target** - link target (e.g., “_blank” for a new window); for use with the **href** channel
489-
* **className** - the [class attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/class), if any (defaults to null) <VersionBadge pr="1098" />
489+
* **className** - the [class attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/class), if any (defaults to null) <VersionBadge version="0.6.16" pr="1098" />
490490
* **ariaDescription** - a textual description of the mark’s contents
491491
* **ariaHidden** - if true, hide this content from the accessibility tree
492492
* **pointerEvents** - the [pointer events](https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events) (*e.g.*, *none*)
@@ -561,7 +561,7 @@ Insets default to zero. Insets are commonly used to create a one-pixel gap betwe
561561

562562
### Rounded corners
563563

564-
Rect-like marks support rounded corners. Each corner (or side) is individually addressable <VersionBadge pr="2099" /> using the following options:
564+
Rect-like marks support rounded corners. Each corner (or side) is individually addressable <VersionBadge version="0.6.16" pr="2099" /> using the following options:
565565

566566
* **r** - the radius for all four corners
567567
* **rx1** - the radius for the **x1**-**y1** and **x1**-**y2** corners

docs/marks/difference.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ Plot.differenceY(gistemp, {x: "Date", y: "Anomaly"})
144144

145145
Returns a new vertical difference with the given *data* and *options*. The mark is a composite of a positive area, negative area, and line. The positive area extends from the bottom of the frame to the line, and is clipped by the area extending from the comparison to the top of the frame. The negative area conversely extends from the top of the frame to the line, and is clipped by the area extending from the comparison to the bottom of the frame.
146146

147-
## differenceX(*data*, *options*) <VersionBadge pr="1922" /> {#differenceX}
147+
## differenceX(*data*, *options*) <VersionBadge version="0.6.16" pr="1922" /> {#differenceX}
148148

149149
```js
150150
Plot.differenceX(gistemp, {y: "Date", x: "Anomaly"})

docs/marks/geo.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ Plot.plot({
5757
```
5858
:::
5959

60-
A geo mark’s data is typically [GeoJSON](https://geojson.org/). You can pass a single GeoJSON object, a feature or geometry collection, or an array or iterable of GeoJSON objects; Plot automatically normalizes these into an array of features or geometries. When a mark’s data is GeoJSON, Plot will look for the specified field name (such as _unemployment_ above, for **fill**) in the GeoJSON object’s `properties` if the object does not have this property directly. <VersionBadge pr="2092" />
60+
A geo mark’s data is typically [GeoJSON](https://geojson.org/). You can pass a single GeoJSON object, a feature or geometry collection, or an array or iterable of GeoJSON objects; Plot automatically normalizes these into an array of features or geometries. When a mark’s data is GeoJSON, Plot will look for the specified field name (such as _unemployment_ above, for **fill**) in the GeoJSON object’s `properties` if the object does not have this property directly. <VersionBadge version="0.6.16" pr="2092" />
6161

6262
The size of Point and MultiPoint geometries is controlled by the **r** option. For example, below we show earthquakes in the last seven days with a magnitude of 2.5 or higher as reported by the [USGS](https://earthquake.usgs.gov/earthquakes/feed/v1.0/geojson.php). As with the [dot mark](./dot.md), the effective radius is controlled by the *r* scale, which is by default a *sqrt* scale such that the area of a point is proportional to its value. And likewise point geometries are by default sorted by descending radius to reduce occlusion, drawing the smallest circles on top. Set the **sort** option to null to use input order instead.
6363

@@ -130,7 +130,7 @@ Plot.plot({
130130
```
131131
:::
132132

133-
By default, the geo mark doesn’t have **x** and **y** channels; when you use the [**tip** option](./tip.md), the [centroid transform](../transforms/centroid.md) is implicitly applied on the geometries to compute the tip position by generating **x** and **y** channels. <VersionBadge pr="2088" /> You can alternatively specify these channels explicitly. The centroids are shown below in red.
133+
By default, the geo mark doesn’t have **x** and **y** channels; when you use the [**tip** option](./tip.md), the [centroid transform](../transforms/centroid.md) is implicitly applied on the geometries to compute the tip position by generating **x** and **y** channels. <VersionBadge version="0.6.16" pr="2088" /> You can alternatively specify these channels explicitly. The centroids are shown below in red.
134134

135135
:::plot defer https://observablehq.com/@observablehq/plot-state-centroids
136136
```js
@@ -176,7 +176,7 @@ The **geometry** channel specifies the geometry (GeoJSON object) to draw; if not
176176

177177
In addition to the [standard mark options](../features/marks.md#mark-options), the **r** option controls the size of Point and MultiPoint geometries. It can be specified as either a channel or constant. When **r** is specified as a number, it is interpreted as a constant radius in pixels; otherwise it is interpreted as a channel and the effective radius is controlled by the *r* scale. If the **r** option is not specified it defaults to 3 pixels. Geometries with a nonpositive radius are not drawn. If **r** is a channel, geometries will be sorted by descending radius by default.
178178

179-
The **x** and **y** position channels may also be specified in conjunction with the **tip** option. <VersionBadge pr="2088" /> These are bound to the *x* and *y* scale (or projection), respectively.
179+
The **x** and **y** position channels may also be specified in conjunction with the **tip** option. <VersionBadge version="0.6.16" pr="2088" /> These are bound to the *x* and *y* scale (or projection), respectively.
180180

181181
## geo(*data*, *options*) {#geo}
182182

docs/marks/waffle.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ onMounted(() => {
2525

2626
</script>
2727

28-
# Waffle mark <VersionBadge pr="2040" />
28+
# Waffle mark <VersionBadge version="0.6.16" pr="2040" />
2929

3030
The **waffle mark** is similar to the [bar mark](./bar.md) in that it displays a quantity (or quantitative extent) for a given category; but unlike a bar, a waffle is subdivided into square cells that allow easier counting. Waffles are useful for reading exact quantities. How quickly can you count the pears 🍐 below? How many more apples 🍎 are there than bananas 🍌?
3131

docs/transforms/shift.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Derives an **x1** channel from the input **x** channel by shifting values by the
4747

4848
The shiftX transform also aliases the **x** channel to **x2** and applies a domain hint to the **x2** channel such that by default the plot shows only the intersection of **x1** and **x2**. For example, if the interval is *+1 year*, the first year of the data is not shown.
4949

50-
## shiftY(*interval*, *options*) <VersionBadge pr="1922" /> {#shiftY}
50+
## shiftY(*interval*, *options*) <VersionBadge version="0.6.16" pr="1922" /> {#shiftY}
5151

5252
```js
5353
Plot.shiftY("7 days", {y: "Date", x: "Close"})

img/arc-diagram.png

-318 Bytes
Loading

img/auto-bar.png

-241 Bytes
Loading

img/axes.png

-17.7 KB
Loading

img/barycentric-before-after.png

-24 Bytes
Loading

img/beagle.png

-80.6 KB
Loading

img/bollinger.png

-66 Bytes
Loading

img/clip.png

-12.6 KB
Loading

img/geo-nc.png

53.8 KB
Loading

img/geo-tip.png

209 KB
Loading

img/group-marker.png

43.6 KB
Loading

img/rect-rounded.png

38 KB
Loading

img/temporal-ordinal.png

-12 Bytes
Loading

img/tip-custom.png

-274 Bytes
Loading

img/title-subtitle.png

-4 Bytes
Loading

img/waffle.png

53.9 KB
Loading

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@observablehq/plot",
33
"description": "A JavaScript library for exploratory data visualization.",
4-
"version": "0.6.15",
4+
"version": "0.6.16",
55
"author": {
66
"name": "Observable, Inc.",
77
"url": "https://observablehq.com"

0 commit comments

Comments
 (0)