-
Notifications
You must be signed in to change notification settings - Fork 230
Expand file tree
/
Copy pathautoplot.js
More file actions
239 lines (193 loc) · 8.91 KB
/
Copy pathautoplot.js
File metadata and controls
239 lines (193 loc) · 8.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
import * as Plot from "@observablehq/plot";
import * as d3 from "d3";
export async function autoHistogram() {
const athletes = await d3.csv("data/athletes.csv", d3.autoType);
return Plot.auto(athletes, {x: "weight"}).plot();
}
export async function autoHistogramDate() {
const athletes = await d3.csv("data/athletes.csv", d3.autoType);
return Plot.auto(athletes, {x: "date_of_birth"}).plot();
}
export async function autoHistogramGroup() {
const penguins = await d3.csv("data/penguins.csv", d3.autoType);
return Plot.auto(penguins, {x: "island"}).plot();
}
export async function autoNullReduceContinuous() {
const penguins = await d3.csv("data/penguins.csv", d3.autoType);
return Plot.auto(penguins, {x: "culmen_length_mm", y: {reduce: null}}).plot();
}
export async function autoNullReduceOrdinal() {
const penguins = await d3.csv("data/penguins.csv", d3.autoType);
return Plot.auto(penguins, {x: "island", y: {reduce: null}}).plot();
}
export async function autoNullReduceDate() {
const athletes = await d3.csv("data/athletes.csv", d3.autoType);
return Plot.auto(athletes, {x: "date_of_birth", y: {reduce: null}}).plot();
}
export async function autoLineHistogram() {
const aapl = await d3.csv("data/aapl.csv", d3.autoType);
return Plot.auto(aapl, {x: "Volume", mark: "line"}).plot();
}
export async function autoLine() {
const aapl = await d3.csv("data/aapl.csv", d3.autoType);
return Plot.auto(aapl, {x: "Date", y: "Close"}).plot();
}
export async function autoArea() {
const aapl = await d3.csv("data/aapl.csv", d3.autoType);
return Plot.auto(aapl, {x: "Date", y: "Close", mark: "area"}).plot();
}
export async function autoAreaColor() {
const aapl = await d3.csv("data/aapl.csv", d3.autoType);
return Plot.auto(aapl, {x: "Date", y: "Close", color: "Close", mark: "area"}).plot();
}
export async function autoAreaColorValue() {
const aapl = await d3.csv("data/aapl.csv", d3.autoType);
return Plot.auto(aapl, {x: "Date", y: "Close", color: {value: "Close"}, mark: "area"}).plot();
}
export async function autoAreaColorName() {
const aapl = await d3.csv("data/aapl.csv", d3.autoType);
return Plot.auto(aapl, {x: "Date", y: "Close", color: "red", mark: "area"}).plot();
}
export async function autoAreaColorColor() {
const aapl = await d3.csv("data/aapl.csv", d3.autoType);
return Plot.auto(aapl, {x: "Date", y: "Close", color: {color: "red"}, mark: "area"}).plot();
}
export async function autoDot() {
const penguins = await d3.csv("data/penguins.csv", d3.autoType);
return Plot.auto(penguins, {x: "culmen_length_mm", y: "body_mass_g"}).plot();
}
export async function autoDotOrdinal() {
const athletes = await d3.csv("data/athletes.csv", d3.autoType);
return Plot.auto(athletes, {x: "sex", y: "nationality"}).plot();
}
export async function autoDotOrdCont() {
const penguins = await d3.csv("data/penguins.csv", d3.autoType);
return Plot.auto(penguins, {x: "culmen_length_mm", y: "species"}).plot();
}
export async function autoBar() {
const alphabet = await d3.csv("data/alphabet.csv", d3.autoType);
return Plot.auto(alphabet, {x: "frequency", y: "letter", mark: "bar"}).plot();
}
export async function autoBarZero() {
const alphabet = await d3.csv("data/alphabet.csv", d3.autoType);
return Plot.auto(alphabet, {x: {value: "frequency", zero: true}, y: "letter"}).plot();
}
export async function autoConnectedScatterplot() {
const driving = await d3.csv("data/driving.csv", d3.autoType);
return Plot.auto(driving, {x: "miles", y: "gas", mark: "line"}).plot();
}
// shouldnt make a line
export async function autoDotUnsortedDate() {
const athletes = await d3.csv("data/athletes.csv", d3.autoType);
return Plot.auto(athletes, {x: "date_of_birth", y: "height"}).plot();
}
export async function autoDotSize() {
const aapl = await d3.csv("data/aapl.csv", d3.autoType);
return Plot.auto(aapl, {x: "Date", size: "Volume"}).plot();
}
export async function autoDotSize2() {
const penguins = await d3.csv("data/penguins.csv", d3.autoType);
return Plot.auto(penguins, {x: "culmen_length_mm", y: "culmen_depth_mm", size: "body_mass_g"}).plot();
}
export async function autoDotGroup() {
const penguins = await d3.csv("data/penguins.csv", d3.autoType);
return Plot.auto(penguins, {x: "island", y: "species", size: "count"}).plot();
}
export async function autoDotBin() {
const penguins = await d3.csv("data/penguins.csv", d3.autoType);
return Plot.auto(penguins, {x: "culmen_length_mm", y: "body_mass_g", size: "count"}).plot();
}
export async function autoDotColor() {
const cars = await d3.csv("data/cars.csv", d3.autoType);
return Plot.auto(cars, {x: "power (hp)", y: "weight (lb)", color: "0-60 mph (s)"}).plot();
}
export async function autoHeatmapOrdCont() {
const penguins = await d3.csv("data/penguins.csv", d3.autoType);
return Plot.auto(penguins, {x: "culmen_length_mm", y: "species", color: "count"}).plot();
}
export async function autoHeatmap() {
const penguins = await d3.csv("data/penguins.csv", d3.autoType);
return Plot.auto(penguins, {x: "culmen_length_mm", y: "body_mass_g", color: "count"}).plot();
}
export async function autoHeatmapOrdinal() {
const penguins = await d3.csv("data/penguins.csv", d3.autoType);
return Plot.auto(penguins, {x: "island", y: "species", color: "count"}).plot();
}
export async function autoBarStackColor() {
const penguins = await d3.csv("data/penguins.csv", d3.autoType);
return Plot.auto(penguins, {y: "species", color: "sex"}).plot();
}
export async function autoBarColorReducer() {
const penguins = await d3.csv("data/penguins.csv", d3.autoType);
return Plot.auto(penguins, {y: "species", color: "count"}).plot();
}
export async function autoRectStackColor() {
const penguins = await d3.csv("data/penguins.csv", d3.autoType);
return Plot.auto(penguins, {x: "culmen_length_mm", color: "island"}).plot();
}
export async function autoRectColorReducer() {
const penguins = await d3.csv("data/penguins.csv", d3.autoType);
return Plot.auto(penguins, {x: "culmen_length_mm", color: {value: "island", reduce: "mode"}}).plot();
}
export async function autoLineColor() {
const aapl = await d3.csv("data/aapl.csv", d3.autoType);
return Plot.auto(aapl, {x: "Date", y: "Close", color: "Close"}).plot();
}
export async function autoLineColorSeries() {
const industries = await d3.csv("data/bls-industry-unemployment.csv", d3.autoType);
return Plot.auto(industries, {x: "date", y: "unemployed", color: "industry"}).plot();
}
export async function autoAreaStackColor() {
const industries = await d3.csv("data/bls-industry-unemployment.csv", d3.autoType);
return Plot.auto(industries, {x: "date", y: "unemployed", color: "industry", mark: "area"}).plot();
}
export async function autoAutoHistogram() {
const weather = await d3.csv("data/seattle-weather.csv", d3.autoType);
return Plot.auto(weather, {x: "temp_max", mark: "area"}).plot();
}
export async function autoBarStackColorField() {
const athletes = await d3.csv("data/athletes.csv", d3.autoType);
return Plot.auto(athletes, {x: "height", color: {value: "gold"}}).plot();
}
export async function autoBarStackColorConstant() {
const athletes = await d3.csv("data/athletes.csv", d3.autoType);
return Plot.auto(athletes, {x: "height", color: "gold"}).plot();
}
export async function autoBarMeanZero() {
const weather = await d3.csv("data/seattle-weather.csv", d3.autoType);
return Plot.auto(weather, {x: "date", y: {value: "temp_max", reduce: "mean", zero: true}}).plot();
}
export async function autoBarMode() {
const penguins = await d3.csv("data/penguins.csv", d3.autoType);
return Plot.auto(penguins, {x: "island", y: {value: "species", reduce: "mode"}, mark: "bar"}).plot();
}
export async function autoLineMean() {
const weather = await d3.csv("data/seattle-weather.csv", d3.autoType);
return Plot.auto(weather, {x: "date", y: {value: "temp_max", reduce: "mean"}}).plot();
}
export async function autoLineMeanColor() {
const athletes = await d3.csv("data/athletes.csv", d3.autoType);
return Plot.auto(athletes, {x: "date_of_birth", y: {value: "height", reduce: "mean"}, color: "sex"}).plot();
}
export async function autoLineMeanThresholds() {
const weather = await d3.csv("data/seattle-weather.csv", d3.autoType);
return Plot.auto(weather, {x: {value: "date", thresholds: "month"}, y: {value: "temp_max", reduce: "mean"}}).plot();
}
export async function autoLineFacet() {
const industries = await d3.csv("data/bls-industry-unemployment.csv", d3.autoType);
return Plot.auto(industries, {x: "date", y: "unemployed", fy: "industry"}).plot();
}
export async function autoDotFacet() {
const penguins = await d3.csv("data/penguins.csv", d3.autoType);
return Plot.auto(penguins, {x: "body_mass_g", y: "culmen_length_mm", fx: "island", color: "sex"}).plot();
}
export async function autoDotFacet2() {
const penguins = await d3.csv("data/penguins.csv", d3.autoType);
return Plot.auto(penguins, {
x: "body_mass_g",
y: "culmen_length_mm",
fx: "island",
fy: "species",
color: "sex"
}).plot();
}