Skip to content

Commit

Permalink
feat: add income across time race and space!
Browse files Browse the repository at this point in the history
  • Loading branch information
jaanli committed Mar 29, 2024
1 parent a27665f commit db4f409
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 11 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,16 @@ A typical Framework project looks like this:
## GPT-4 reference

https://chat.openai.com/share/0284945f-996d-4e62-85c5-bdc0f4e68e18

## Making GIFs for demos

1. Use Quicktime Player to record a screen recording.
2. Use `ffmpeg` to trim the recording:
```sh
ffmpeg -ss 00:00:03 -to 00:00:08 -i recording.mov -c copy trimmed_recording.mov
```
3. Use `ffmpeg` to convert the trimmed recording to a GIF:
```sh
ffmpeg -i trimmed_recording.mov -vf "fps=20,scale=1080:-1:flags=lanczos,palettegen=stats_mode=diff" -y palette.png
ffmpeg -i trimmed_recording.mov -i palette.png -filter_complex "fps=20,scale=1080:-1:flags=lanczos[x];[x][1:v]paletteuse=dither=bayer:bayer_scale=5:diff_mode=rectangle" -y high_quality.gif
```
Binary file not shown.
6 changes: 3 additions & 3 deletions docs/new-york-area.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ const income = await db.query(`
<!-- ```js
const medianIncome = await db.query(`
SELECT
quantile_cont(0.5) WITHIN GROUP (ORDER BY income) AS median_income
FROM data
percentile_cont(0.5) WITHIN GROUP (ORDER BY income) AS median_income
FROM data, generate_series(1, CAST(count AS INT))
WHERE year = ${selectedYear} AND puma = '${selectedPUMA}' AND state_code = '${selectedStateCode}';
`);
``` -->
Expand Down Expand Up @@ -119,7 +119,7 @@ function incomeChart(income, width) {
}
)
),
// Plot.ruleX([medianIncome], {stroke: "red", strokeWidth: 2})
// Plot.ruleX([medianIncome[0].median_income], {stroke: "red", strokeWidth: 2})
],
});
}
Expand Down
7 changes: 0 additions & 7 deletions docs/new-york-area/income-by-race.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,6 @@ const selectedStateCode = selectedPUMADetails.stateCode;

```js
const mostRecentYear = uniqueYears[uniqueYears.length - 1];
const orderSectors = await db.query(`
SELECT sector, SUM(income * count) / SUM(count) AS mean_income
FROM data
WHERE year = ${mostRecentYear}
GROUP BY sector
ORDER BY mean_income DESC
`).then(data => data.map(d => d.sector));
```

```js
Expand Down
3 changes: 2 additions & 1 deletion observablehq.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ export default {
name: "Variables in the Survey",
pages: [
{name: "Income over the years", path: "/income"},
{name: "New York area income over the years", path: "/new-york-area"}
{name: "New York area income over the years", path: "/new-york-area"},
{name: "New York area income across time, space, and race", path: "/new-york-area/income-by-race"}
]
}
],
Expand Down

0 comments on commit db4f409

Please sign in to comment.