Skip to content

Commit 7bb533c

Browse files
committed
Update README
1 parent 05e37b4 commit 7bb533c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -990,7 +990,7 @@ makes a histogram (equivalent to [rectY](#rect) and [binX](#bin); chosen because
990990
Plot.auto(penguins, {x: "island"}).plot()
991991
```
992992
993-
makes a bar chart (equivalent to [barY](#bar) and [groupX](#group); chosen because the _island_ column is categorical).
993+
makes a bar chart (equivalent to [barY](#bar) and [groupX](#group); chosen because the _island_ column is categorical). Note that Plot.auto returns a mark; to generate a plot of this mark, call [*mark*.plot](#markplotoptions) on the returned mark. This allows passing additional plot options, such as to set the dimensions of the plot or to override the scale type. You can also combine the auto mark with other marks—even other auto marks.
994994
995995
Plot.auto seeks to provide a useful initial plot as quickly as possible through opinionated defaults, and to accelerate exploratory analysis by letting you see different dimensions of data with minimal code. For example, you can switch a vertical bar chart to a horizontal one by changing *x* to *y*; you don’t also have to switch barY to barX and groupX to groupY.
996996
@@ -1012,31 +1012,31 @@ And you may specify the standard mark-level facet channels:
10121012
In addition to channel values, the **x**, **y**, **color**, and **size** options may specify reducers. Setting a reducer on **x** implicitly groups or bins on **y**, and likewise setting a reducer on **y** implicitly groups or bins on **x**. Setting a reducer on **color** or **size** groups or bins in both **x** and **y**. Setting a reducer on both **x** and **y** throws an error. To specify a reducer, simply pass the reducer name to the corresponding option. For example:
10131013
10141014
```js
1015-
Plot.auto(penguins, {x: "body_mass_g", y: "count"}).plot()
1015+
Plot.auto(penguins, {x: "body_mass_g", y: "count"})
10161016
```
10171017
10181018
To pass both a value and a reducer, or to disambiguate whether the given string represents a field name or a reducer name, the **x**, **y**, **color**, and **size** options can also be specified as an object with separate **value** and **reduce** properties. For example, to compute the total weight of the penguins in each bin:
10191019
10201020
```js
1021-
Plot.auto(penguins, {x: "body_mass_g", y: {value: "body_mass_g", reduce: "sum"}}).plot()
1021+
Plot.auto(penguins, {x: "body_mass_g", y: {value: "body_mass_g", reduce: "sum"}})
10221022
```
10231023
10241024
If the **color** channel is specified as a string that is also a valid CSS color, it is interpreted as a constant color. For example, for red bars:
10251025
10261026
```js
1027-
Plot.auto(penguins, {x: "body_mass_g", color: "red"}).plot()
1027+
Plot.auto(penguins, {x: "body_mass_g", color: "red"})
10281028
```
10291029
10301030
This is shorthand for:
10311031
10321032
```js
1033-
Plot.auto(penguins, {x: "body_mass_g", color: {color: "red"}}).plot()
1033+
Plot.auto(penguins, {x: "body_mass_g", color: {color: "red"}})
10341034
```
10351035
10361036
To reference a field name instead as a variable color encoding, specify the **color** option as an object with a **value** property:
10371037
10381038
```js
1039-
Plot.auto(penguins, {x: "body_mass_g", color: {value: "red"}}).plot()
1039+
Plot.auto(penguins, {x: "body_mass_g", color: {value: "red"}})
10401040
```
10411041
10421042
Alternatively, you can specify a function of data or an array of values, as with a standard mark channel.

0 commit comments

Comments
 (0)