From ead47fd61a9a633400b0eae17458041031ac07ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Rivi=C3=A8re?= Date: Wed, 19 Jan 2022 15:32:30 +0100 Subject: [PATCH 1/3] use x, y and dy when there is no rotate test multiline (with 1 empty line) document --- README.md | 8 +- src/marks/text.js | 9 +- test/output/caltrain.html | 10 +- test/output/carsParcoords.svg | 4 +- test/output/covidIhmeProjectedDeaths.svg | 2 +- test/output/documentationLinks.svg | 2 +- test/output/firstLadies.svg | 2 +- test/output/fruitSalesDate.svg | 2 +- test/output/gridChoropleth.svg | 4 +- test/output/letterFrequencyCloud.svg | 2 +- test/output/letterFrequencyWheel.svg | 100 ++++++++++++++++++++ test/output/metroInequalityChange.svg | 2 +- test/output/mobyDickLetterPairs.svg | 2 +- test/output/penguinSpeciesGroup.svg | 2 +- test/output/polylinear.svg | 2 +- test/output/simpsonsRatings.svg | 2 +- test/output/softwareVersions.svg | 2 +- test/output/stargazers.svg | 2 +- test/output/stocksIndex.svg | 2 +- test/output/travelersYearOverYear.svg | 4 +- test/output/usPopulationStateAgeDots.svg | 2 +- test/output/wealthBritainBar.svg | 2 +- test/output/wealthBritainProportionPlot.svg | 6 +- test/output/wordCloud.svg | 2 +- test/plots/index.js | 1 + test/plots/letter-frequency-wheel.js | 40 ++++++++ test/plots/letter-wheel.js | 40 ++++++++ 27 files changed, 219 insertions(+), 39 deletions(-) create mode 100644 test/output/letterFrequencyWheel.svg create mode 100644 test/plots/letter-frequency-wheel.js create mode 100644 test/plots/letter-wheel.js diff --git a/README.md b/README.md index 099892414c..2473eeefb9 100644 --- a/README.md +++ b/README.md @@ -1068,7 +1068,7 @@ If an **interval** is specified, such as d3.utcDay, **x1** and **x2** can be der The following channels are required: -* **text** - the text contents (a string) +* **text** - the text contents (a string); if the string contains line break characters, the mark will wrap each line in a tspan and create a multiline text. If **text** is not specified, it defaults to [0, 1, 2, …] so that something is visible by default. Due to the design of SVG, each label is currently limited to one line; in the future we may support multiline text. [#327](https://github.com/observablehq/plot/pull/327) For embedding numbers and dates into text, consider [*number*.toLocaleString](https://observablehq.com/@mbostock/number-formatting), [*date*.toLocaleString](https://observablehq.com/@mbostock/date-formatting), [d3-format](https://github.com/d3/d3-format), or [d3-time-format](https://github.com/d3/d3-time-format). @@ -1081,9 +1081,9 @@ In addition to the [standard mark options](#marks), the following optional chann The following text-specific constant options are also supported: -* **textAnchor** - TODO -* **lineAnchor** - TODO -* **lineHeight** - TODO +* **textAnchor** - the [text anchor](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/text-anchor); start, end, or middle (default) +* **lineAnchor** - for multiline text, the vertical line anchor; top, bottom, or middle (default) +* **lineHeight** - for multiline text,the line height factor; defaults to 1.0, which corresponds to a CSS length of 1em * **fontFamily** - the font name; defaults to [system-ui](https://drafts.csswg.org/css-fonts-4/#valdef-font-family-system-ui) * **fontSize** - the font size in pixels; defaults to 10 * **fontStyle** - the [font style](https://developer.mozilla.org/en-US/docs/Web/CSS/font-style); defaults to normal diff --git a/src/marks/text.js b/src/marks/text.js index b83bafcb4b..4388442f7d 100644 --- a/src/marks/text.js +++ b/src/marks/text.js @@ -70,10 +70,9 @@ export class Text extends Mark { : X ? i => `translate(${X[i]},${cy}) rotate(${rotate})` : Y ? i => `translate(${cx},${Y[i]}) rotate(${rotate})` : `translate(${cx},${cy}) rotate(${rotate})`) - : (X && Y ? i => `translate(${X[i]},${Y[i]})` - : X ? i => `translate(${X[i]},${cy})` - : Y ? i => `translate(${cx},${Y[i]})` - : `translate(${cx},${cy})`)) + : null) + .attr("x", (R || rotate) ? null : X ? i => X[i] : cx) + .attr("y", (R || rotate) ? null : Y ? i => Y[i] : cy) .call(applyAttr, "font-size", FS && (i => FS[i])) .call(applyChannelStyles, this, channels) .call(applyMultilineText, this, T)) @@ -98,7 +97,7 @@ function applyMultilineText(selection, {lineAnchor, lineHeight}, T) { this.appendChild(tspan); } } else { - if (y) this.setAttribute("y", `${y * lineHeight}em`); + if (y) this.setAttribute("dy", `${y * lineHeight}em`); this.textContent = lines[0]; } }); diff --git a/test/output/caltrain.html b/test/output/caltrain.html index 7d7af7dcb8..b6cae84850 100644 --- a/test/output/caltrain.html +++ b/test/output/caltrain.html @@ -46,11 +46,11 @@ white-space: pre; } - Northbound - Southbound - 5a8p9p10p11p8a9a5p6p10a11a12p1p2p3p4p6a7a7p12a - 010101010105050506061011111116161616162123232324242436363636384141414141415454 - 010101020303030303030312121218181821252525262626263636363838384449495151515757 + Northbound + Southbound + 5a8p9p10p11p8a9a5p6p10a11a12p1p2p3p4p6a7a7p12a + 010101010105050506061011111116161616162123232324242436363636384141414141415454 + 010101020303030303030312121218181821252525262626263636363838384449495151515757 diff --git a/test/output/carsParcoords.svg b/test/output/carsParcoords.svg index 6fe71cdd10..a581d79ade 100644 --- a/test/output/carsParcoords.svg +++ b/test/output/carsParcoords.svg @@ -449,6 +449,6 @@ - 101520253035404534567810015020025030035040045060801001201401601802002202,0002,5003,0003,5004,0004,5005,0008101214161820222470727476788082 - 101520253035404534567810015020025030035040045060801001201401601802002202,0002,5003,0003,5004,0004,5005,0008101214161820222470727476788082 + 101520253035404534567810015020025030035040045060801001201401601802002202,0002,5003,0003,5004,0004,5005,0008101214161820222470727476788082 + 101520253035404534567810015020025030035040045060801001201401601802002202,0002,5003,0003,5004,0004,5005,0008101214161820222470727476788082 \ No newline at end of file diff --git a/test/output/covidIhmeProjectedDeaths.svg b/test/output/covidIhmeProjectedDeaths.svg index c97b03ba69..bdc22edb9d 100644 --- a/test/output/covidIhmeProjectedDeaths.svg +++ b/test/output/covidIhmeProjectedDeaths.svg @@ -238,5 +238,5 @@ - 900 + 900 \ No newline at end of file diff --git a/test/output/documentationLinks.svg b/test/output/documentationLinks.svg index 13236cc02f..60d206c4a2 100644 --- a/test/output/documentationLinks.svg +++ b/test/output/documentationLinks.svg @@ -178,7 +178,7 @@ - ⚡︎ 296 16 18 6 10 3 9 17 5 11 8 2 2 4 5 1 3 7 12 13 6 3 6 7 18 + ⚡︎ 296 16 18 6 10 3 9 17 5 11 8 2 2 4 5 1 3 7 12 13 6 3 6 7 18 diff --git a/test/output/firstLadies.svg b/test/output/firstLadies.svg index 8ff2935e32..69c9ff4fcc 100644 --- a/test/output/firstLadies.svg +++ b/test/output/firstLadies.svg @@ -171,5 +171,5 @@ - Martha WashingtonAbigail AdamsMartha JeffersonDolly MadisonElizabeth MonroeLouisa AdamsEmily DonelsonSarah JacksonSarah Van BurenAnna HarrisonJane HarrisonLetitia TylerElizabeth Priscilla TylerJulia TylerSarah PolkMargaret "Peggy" TaylorAbigail FillmoreJane PierceHarriet LaneMary LincolnEliza JohnsonJulia GrantLucy HayesLucretia GarfieldMary McElroyRose ClevelandFrances ClevelandCaroline HarrisonMary Harrison McKeeFrances ClevelandIda McKinleyEdith RooseveltHelen "Nellie" TaftEllen WilsonMargaret WilsonEdith WilsonFlorence HardingGrace CoolidgeLou HooverAnna Eleanor RooseveltElizabeth "Bess" TrumanMamie EisenhowerJacqueline "Jackie" KennedyClaudia "Lady Bird" JohnsonThelma "Pat" NixonElizabeth "Betty" FordEleanor Rosalynn CarterNancy ReaganBarbara BushHillary ClintonLaura BushMichelle ObamaMelania TrumpJill Biden + Martha WashingtonAbigail AdamsMartha JeffersonDolly MadisonElizabeth MonroeLouisa AdamsEmily DonelsonSarah JacksonSarah Van BurenAnna HarrisonJane HarrisonLetitia TylerElizabeth Priscilla TylerJulia TylerSarah PolkMargaret "Peggy" TaylorAbigail FillmoreJane PierceHarriet LaneMary LincolnEliza JohnsonJulia GrantLucy HayesLucretia GarfieldMary McElroyRose ClevelandFrances ClevelandCaroline HarrisonMary Harrison McKeeFrances ClevelandIda McKinleyEdith RooseveltHelen "Nellie" TaftEllen WilsonMargaret WilsonEdith WilsonFlorence HardingGrace CoolidgeLou HooverAnna Eleanor RooseveltElizabeth "Bess" TrumanMamie EisenhowerJacqueline "Jackie" KennedyClaudia "Lady Bird" JohnsonThelma "Pat" NixonElizabeth "Betty" FordEleanor Rosalynn CarterNancy ReaganBarbara BushHillary ClintonLaura BushMichelle ObamaMelania TrumpJill Biden \ No newline at end of file diff --git a/test/output/fruitSalesDate.svg b/test/output/fruitSalesDate.svg index 8d359220bb..435f564d8f 100644 --- a/test/output/fruitSalesDate.svg +++ b/test/output/fruitSalesDate.svg @@ -52,5 +52,5 @@ - applesorangesgrapesapplesorangesgrapesbananas + applesorangesgrapesapplesorangesgrapesbananas \ No newline at end of file diff --git a/test/output/gridChoropleth.svg b/test/output/gridChoropleth.svg index 8a7a83011e..f3c450ac40 100644 --- a/test/output/gridChoropleth.svg +++ b/test/output/gridChoropleth.svg @@ -65,6 +65,6 @@ - CATXFLNYPAILOHGANCMINJVAWAAZMATNINMOMDWICOMNSCALLAKYOROKCTUTIANVARMSKSNMNEWVIDHINHMEMTRIDESDNDAKDCVTWY - +6%+15%+14%+0%+1%−1%+1%+10%+10%+1%+1%+7%+13%+14%+6%+8%+4%+2%+5%+2%+15%+6%+11%+3%+3%+3%+10%+5%−0%+16%+4%+14%+3%+0%+2%+2%+6%−3%+14%+4%+3%+1%+8%+1%+8%+9%+13%+3%+17%−0%+3% + CATXFLNYPAILOHGANCMINJVAWAAZMATNINMOMDWICOMNSCALLAKYOROKCTUTIANVARMSKSNMNEWVIDHINHMEMTRIDESDNDAKDCVTWY + +6%+15%+14%+0%+1%−1%+1%+10%+10%+1%+1%+7%+13%+14%+6%+8%+4%+2%+5%+2%+15%+6%+11%+3%+3%+3%+10%+5%−0%+16%+4%+14%+3%+0%+2%+2%+6%−3%+14%+4%+3%+1%+8%+1%+8%+9%+13%+3%+17%−0%+3% \ No newline at end of file diff --git a/test/output/letterFrequencyCloud.svg b/test/output/letterFrequencyCloud.svg index d70f9f12f8..2bccbe2f11 100644 --- a/test/output/letterFrequencyCloud.svg +++ b/test/output/letterFrequencyCloud.svg @@ -12,5 +12,5 @@ white-space: pre; } - ETAOINSHRDLCUMWFGYPBVKJXQZ + ETAOINSHRDLCUMWFGYPBVKJXQZ \ No newline at end of file diff --git a/test/output/letterFrequencyWheel.svg b/test/output/letterFrequencyWheel.svg new file mode 100644 index 0000000000..7de72802df --- /dev/null +++ b/test/output/letterFrequencyWheel.svg @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ABCDEFGHIJKLMNOPQRSTUVWXYZ + + 8.2% + + 1.5% + + 2.8% + + 4.3% + + 12.7% + + 2.3% + + 2.0% + + 6.1% + + 7.0% + + 0.2% + + 0.8% + + 4.0% + + 2.4% + + 6.7% + + 7.5% + + 1.9% + + 0.1% + + 6.0% + + 6.3% + + 9.1% + + 2.8% + + 1.0% + + 2.4% + + 0.1% + + 2.0% + + 0.1% + + \ No newline at end of file diff --git a/test/output/metroInequalityChange.svg b/test/output/metroInequalityChange.svg index f4e625d14f..6286883207 100644 --- a/test/output/metroInequalityChange.svg +++ b/test/output/metroInequalityChange.svg @@ -333,5 +333,5 @@ - New YorkChicagoHoustonWashington, D.C.San FranciscoSan JoseFairfield, Conn.Binghamton, N.Y. + New YorkChicagoHoustonWashington, D.C.San FranciscoSan JoseFairfield, Conn.Binghamton, N.Y. \ No newline at end of file diff --git a/test/output/mobyDickLetterPairs.svg b/test/output/mobyDickLetterPairs.svg index 77636c3c91..0070d5d019 100644 --- a/test/output/mobyDickLetterPairs.svg +++ b/test/output/mobyDickLetterPairs.svg @@ -124,5 +124,5 @@ - ***********************AAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBCCCCCCCCCCCCDDDDDDDDDDDEEEEEEEEEEEEEEEEEEEEEEEEEFFFFFFFFFFFFFFGGGGGGGGGGGHHHHHHHHHHHIIIIIIIIIIIIIIIIIIIIIIIJJJKKKKKKKKKKLLLLLLLLLLLLLLLLLLLLMMMMMMMMMMMMMMNNNNNNNNNNNNOOOOOOOOOOOOOOOOOOOOOPPPPPPPPPPPPPPQQQRRRRRRRRRRRRRRRRSSSSSSSSSSSSSSSSSSSSSSTTTTTTTTTTTTTTTTTTUUUUUUUUUUUUUUUUUUUVVVVVVVVWWWWWWWWWXXXYYYYYYYYYYYYYYYYYYZZZZ + ***********************AAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBCCCCCCCCCCCCDDDDDDDDDDDEEEEEEEEEEEEEEEEEEEEEEEEEFFFFFFFFFFFFFFGGGGGGGGGGGHHHHHHHHHHHIIIIIIIIIIIIIIIIIIIIIIIJJJKKKKKKKKKKLLLLLLLLLLLLLLLLLLLLMMMMMMMMMMMMMMNNNNNNNNNNNNOOOOOOOOOOOOOOOOOOOOOPPPPPPPPPPPPPPQQQRRRRRRRRRRRRRRRRSSSSSSSSSSSSSSSSSSSSSSTTTTTTTTTTTTTTTTTTUUUUUUUUUUUUUUUUUUUVVVVVVVVWWWWWWWWWXXXYYYYYYYYYYYYYYYYYYZZZZ \ No newline at end of file diff --git a/test/output/penguinSpeciesGroup.svg b/test/output/penguinSpeciesGroup.svg index 5c6da55f7c..3443e728b5 100644 --- a/test/output/penguinSpeciesGroup.svg +++ b/test/output/penguinSpeciesGroup.svg @@ -52,7 +52,7 @@ - AdelieChinstrapGentoo + AdelieChinstrapGentoo diff --git a/test/output/polylinear.svg b/test/output/polylinear.svg index a84b5f1c5a..52cce00f60 100644 --- a/test/output/polylinear.svg +++ b/test/output/polylinear.svg @@ -141,5 +141,5 @@ - InitiateBeginEntryTestDriveDriveBrakeStopShutdown + InitiateBeginEntryTestDriveDriveBrakeStopShutdown \ No newline at end of file diff --git a/test/output/simpsonsRatings.svg b/test/output/simpsonsRatings.svg index 3fb71e2404..ae88717ac1 100644 --- a/test/output/simpsonsRatings.svg +++ b/test/output/simpsonsRatings.svg @@ -830,5 +830,5 @@ - 7.48.38.28.18.08.47.88.08.27.68.58.07.78.77.77.98.28.58.38.27.97.88.48.28.58.07.98.87.78.48.68.08.78.28.18.27.97.58.68.58.47.88.58.57.98.18.38.68.38.78.58.38.37.78.28.88.08.37.77.89.07.87.98.98.77.78.07.87.47.78.05.18.27.87.98.58.18.28.08.27.77.57.67.27.97.57.67.17.37.97.36.67.37.67.17.77.37.27.46.97.37.57.27.77.56.57.05.68.77.07.37.36.87.37.26.97.77.37.27.27.37.16.97.07.37.27.17.17.07.17.06.97.27.36.38.36.76.96.47.06.66.77.56.86.97.06.47.07.17.27.18.16.76.77.16.97.76.76.97.16.97.17.27.27.06.37.16.86.87.17.15.76.96.66.87.26.97.07.07.26.17.07.37.26.67.26.26.15.76.78.57.16.94.56.37.27.06.56.26.56.87.06.76.56.57.26.77.06.57.76.76.96.36.96.85.86.77.57.87.98.38.27.57.78.18.27.57.57.96.86.76.88.46.8---6.67.37.16.48.27.87.87.67.78.48.68.28.58.18.18.79.08.38.47.78.27.97.88.29.08.07.78.98.08.68.17.88.28.28.18.48.88.38.58.48.08.08.28.68.37.78.59.08.08.18.58.36.08.58.18.38.08.98.28.99.08.97.58.78.18.58.38.08.17.78.38.28.08.27.77.97.57.98.08.17.58.28.28.88.37.39.17.68.38.17.67.78.08.07.38.07.37.26.97.67.37.36.97.87.77.27.57.37.07.37.37.77.17.36.97.56.67.97.37.37.48.66.57.37.07.76.97.07.17.77.17.16.97.27.37.16.87.36.96.97.37.26.87.16.67.06.67.48.66.66.77.37.06.26.86.97.36.96.46.96.97.07.36.76.66.77.37.07.37.06.97.17.47.36.87.67.27.16.37.16.36.16.66.67.07.16.36.66.87.27.16.47.36.67.37.07.37.07.36.67.17.27.07.57.07.06.37.17.27.26.76.67.26.96.37.26.76.96.66.57.26.86.56.77.27.06.46.66.36.86.97.37.06.77.07.16.76.76.96.57.07.47.86.57.66.97.07.17.16.56.66.46.57.37.27.06.37.17.07.36.65.86.56.36.86.66.75.96.26.76.37.36.36.96.95.86.56.76.87.36.76.56.96.37.17.28.08.88.18.29.09.07.78.88.48.29.09.19.28.59.28.17.77.68.08.08.68.07.68.27.97.56.77.57.37.47.26.57.17.17.07.47.46.56.77.27.17.27.36.76.97.16.87.17.26.96.66.46.96.67.27.07.17.37.17.17.26.97.26.76.76.98.25.97.06.36.87.07.07.36.96.47.0 + 7.48.38.28.18.08.47.88.08.27.68.58.07.78.77.77.98.28.58.38.27.97.88.48.28.58.07.98.87.78.48.68.08.78.28.18.27.97.58.68.58.47.88.58.57.98.18.38.68.38.78.58.38.37.78.28.88.08.37.77.89.07.87.98.98.77.78.07.87.47.78.05.18.27.87.98.58.18.28.08.27.77.57.67.27.97.57.67.17.37.97.36.67.37.67.17.77.37.27.46.97.37.57.27.77.56.57.05.68.77.07.37.36.87.37.26.97.77.37.27.27.37.16.97.07.37.27.17.17.07.17.06.97.27.36.38.36.76.96.47.06.66.77.56.86.97.06.47.07.17.27.18.16.76.77.16.97.76.76.97.16.97.17.27.27.06.37.16.86.87.17.15.76.96.66.87.26.97.07.07.26.17.07.37.26.67.26.26.15.76.78.57.16.94.56.37.27.06.56.26.56.87.06.76.56.57.26.77.06.57.76.76.96.36.96.85.86.77.57.87.98.38.27.57.78.18.27.57.57.96.86.76.88.46.8---6.67.37.16.48.27.87.87.67.78.48.68.28.58.18.18.79.08.38.47.78.27.97.88.29.08.07.78.98.08.68.17.88.28.28.18.48.88.38.58.48.08.08.28.68.37.78.59.08.08.18.58.36.08.58.18.38.08.98.28.99.08.97.58.78.18.58.38.08.17.78.38.28.08.27.77.97.57.98.08.17.58.28.28.88.37.39.17.68.38.17.67.78.08.07.38.07.37.26.97.67.37.36.97.87.77.27.57.37.07.37.37.77.17.36.97.56.67.97.37.37.48.66.57.37.07.76.97.07.17.77.17.16.97.27.37.16.87.36.96.97.37.26.87.16.67.06.67.48.66.66.77.37.06.26.86.97.36.96.46.96.97.07.36.76.66.77.37.07.37.06.97.17.47.36.87.67.27.16.37.16.36.16.66.67.07.16.36.66.87.27.16.47.36.67.37.07.37.07.36.67.17.27.07.57.07.06.37.17.27.26.76.67.26.96.37.26.76.96.66.57.26.86.56.77.27.06.46.66.36.86.97.37.06.77.07.16.76.76.96.57.07.47.86.57.66.97.07.17.16.56.66.46.57.37.27.06.37.17.07.36.65.86.56.36.86.66.75.96.26.76.37.36.36.96.95.86.56.76.87.36.76.56.96.37.17.28.08.88.18.29.09.07.78.88.48.29.09.19.28.59.28.17.77.68.08.08.68.07.68.27.97.56.77.57.37.47.26.57.17.17.07.47.46.56.77.27.17.27.36.76.97.16.87.17.26.96.66.46.96.67.27.07.17.37.17.17.26.97.26.76.76.98.25.97.06.36.87.07.07.36.96.47.0 \ No newline at end of file diff --git a/test/output/softwareVersions.svg b/test/output/softwareVersions.svg index c369d72ec5..d3d0b43df8 100644 --- a/test/output/softwareVersions.svg +++ b/test/output/softwareVersions.svg @@ -56,7 +56,7 @@ - 348368429359369381324 + 348368429359369381324 diff --git a/test/output/stargazers.svg b/test/output/stargazers.svg index 41e42606aa..6425eb33d3 100644 --- a/test/output/stargazers.svg +++ b/test/output/stargazers.svg @@ -87,5 +87,5 @@ - 1,096 + 1,096 \ No newline at end of file diff --git a/test/output/stocksIndex.svg b/test/output/stocksIndex.svg index 839014a0fe..470d8c60cc 100644 --- a/test/output/stocksIndex.svg +++ b/test/output/stocksIndex.svg @@ -80,5 +80,5 @@ - AAPLAMZNGOOGIBM + AAPLAMZNGOOGIBM \ No newline at end of file diff --git a/test/output/travelersYearOverYear.svg b/test/output/travelersYearOverYear.svg index c23956a304..75efb1c72a 100644 --- a/test/output/travelersYearOverYear.svg +++ b/test/output/travelersYearOverYear.svg @@ -119,6 +119,6 @@ - 2019 - 2020 + 2019 + 2020 \ No newline at end of file diff --git a/test/output/usPopulationStateAgeDots.svg b/test/output/usPopulationStateAgeDots.svg index 4e047195c2..43447aa8a6 100644 --- a/test/output/usPopulationStateAgeDots.svg +++ b/test/output/usPopulationStateAgeDots.svg @@ -585,5 +585,5 @@ - ALAKAZARCACOCTDEDCFLGAHIIDILINIAKSKYLAMEMDMAMIMNMSMOMTNENVNHNJNMNYNCNDOHOKORPARISCSDTNTXUTVTVAWAWVWIWYPR + ALAKAZARCACOCTDEDCFLGAHIIDILINIAKSKYLAMEMDMAMIMNMSMOMTNENVNHNJNMNYNCNDOHOKORPARISCSDTNTXUTVTVAWAWVWIWYPR \ No newline at end of file diff --git a/test/output/wealthBritainBar.svg b/test/output/wealthBritainBar.svg index b6493032d3..63318f9c11 100644 --- a/test/output/wealthBritainBar.svg +++ b/test/output/wealthBritainBar.svg @@ -53,7 +53,7 @@ - 16-34’s35-54’s55-74’sOver 75’s + 16-34’s35-54’s55-74’sOver 75’s diff --git a/test/output/wealthBritainProportionPlot.svg b/test/output/wealthBritainProportionPlot.svg index ae4fa743d5..991e0a33bd 100644 --- a/test/output/wealthBritainProportionPlot.svg +++ b/test/output/wealthBritainProportionPlot.svg @@ -26,7 +26,7 @@ - 30%33%28%9% - 3%32%52%13% - 16-34’s35-54’s55-74’sOver 75’s + 30%33%28%9% + 3%32%52%13% + 16-34’s35-54’s55-74’sOver 75’s \ No newline at end of file diff --git a/test/output/wordCloud.svg b/test/output/wordCloud.svg index bdb65c4645..4eef1cc4cd 100644 --- a/test/output/wordCloud.svg +++ b/test/output/wordCloud.svg @@ -12,5 +12,5 @@ white-space: pre; } - a (69)about (7)account (2)ago (2)air (2)all (23)almost (3)aloft (2)always (2)am (4)among (2)an (4)and (73)any (2)are (5)as (26)at (5)be (9)because (4)been (2)before (3)begin (2)being (4)besides (2)better (2)between (2)broiled (3)but (15)by (8)can (6)cannot (2)captain (2)care (2)chief (2)city (2)come (3)commodore (2)content (2)cook (3)could (2)country (2)crowds (2)deck (2)deep (2)did (5)distant (2)do (8)does (2)down (6)each (2)else (2)ever (5)every (4)exactly (2)fates (2)find (2)first (4)fixed (2)for (16)forecastle (2)from (11)get (6)glory (2)go (12)going (4)grand (3)great (3)grow (2)hand (3)have (8)having (2)he (10)head (4)healthy (2)here (5)high (4)hill (2)him (3)himself (2)his (10)how (3)however (2)hunks (2)i (43)if (9)image (3)in (48)into (9)is (34)ishmael (2)it (33)its (2)just (2)land (6)lead (2)leaders (2)leaves (2)let (2)like (6)little (4)long (2)look (2)magic (2)make (2)man (3)mast (2)may (3)me (25)meadow (2)mean (2)meaning (2)men (4)metaphysical (2)miles (3)money (4)more (6)most (5)motives (2)much (4)must (4)my (14)myself (3)never (5)no (6)not (11)nothing (3)now (5)ocean (2)of (81)off (3)officer (2)old (6)on (12)once (2)one (10)or (10)order (2)other (5)others (2)ourselves (2)out (3)over (2)own (2)paid (2)part (7)particular (2)parts (3)passenger (4)passengers (3)pay (2)paying (3)perhaps (2)phantom (2)plunged (2)point (2)previous (2)purse (3)requires (2)respectfully (2)reveries (2)right (3)robust (2)round (2)sail (2)sailor (5)same (5)say (3)schoolmaster (2)scores (2)sea (13)seas (2)see (6)set (3)shepherds (2)ship (3)ships (3)should (3)sight (2)sleep (2)so (4)some (11)something (3)sort (3)soul (3)spar (2)stand (5)still (3)stream (2)streets (2)strong (2)such (5)take (6)tell (4)than (4)that (31)the (124)their (4)them (5)themselves (2)then (5)there (16)these (4)they (12)thing (2)things (4)think (2)thinks (2)this (17)those (4)though (7)thousand (2)thousands (2)thump (2)time (6)to (53)two (4)under (2)unless (2)up (4)upon (9)voyage (6)warehouses (2)was (8)water (8)way (6)we (3)well (2)were (7)whale (3)whaling (5)what (9)when (5)whenever (5)where (2)which (4)who (5)why (7)wild (2)will (6)winds (3)with (13)without (3)world (4)would (4)yet (4)yonder (2)you (23)your (6) + a (69)about (7)account (2)ago (2)air (2)all (23)almost (3)aloft (2)always (2)am (4)among (2)an (4)and (73)any (2)are (5)as (26)at (5)be (9)because (4)been (2)before (3)begin (2)being (4)besides (2)better (2)between (2)broiled (3)but (15)by (8)can (6)cannot (2)captain (2)care (2)chief (2)city (2)come (3)commodore (2)content (2)cook (3)could (2)country (2)crowds (2)deck (2)deep (2)did (5)distant (2)do (8)does (2)down (6)each (2)else (2)ever (5)every (4)exactly (2)fates (2)find (2)first (4)fixed (2)for (16)forecastle (2)from (11)get (6)glory (2)go (12)going (4)grand (3)great (3)grow (2)hand (3)have (8)having (2)he (10)head (4)healthy (2)here (5)high (4)hill (2)him (3)himself (2)his (10)how (3)however (2)hunks (2)i (43)if (9)image (3)in (48)into (9)is (34)ishmael (2)it (33)its (2)just (2)land (6)lead (2)leaders (2)leaves (2)let (2)like (6)little (4)long (2)look (2)magic (2)make (2)man (3)mast (2)may (3)me (25)meadow (2)mean (2)meaning (2)men (4)metaphysical (2)miles (3)money (4)more (6)most (5)motives (2)much (4)must (4)my (14)myself (3)never (5)no (6)not (11)nothing (3)now (5)ocean (2)of (81)off (3)officer (2)old (6)on (12)once (2)one (10)or (10)order (2)other (5)others (2)ourselves (2)out (3)over (2)own (2)paid (2)part (7)particular (2)parts (3)passenger (4)passengers (3)pay (2)paying (3)perhaps (2)phantom (2)plunged (2)point (2)previous (2)purse (3)requires (2)respectfully (2)reveries (2)right (3)robust (2)round (2)sail (2)sailor (5)same (5)say (3)schoolmaster (2)scores (2)sea (13)seas (2)see (6)set (3)shepherds (2)ship (3)ships (3)should (3)sight (2)sleep (2)so (4)some (11)something (3)sort (3)soul (3)spar (2)stand (5)still (3)stream (2)streets (2)strong (2)such (5)take (6)tell (4)than (4)that (31)the (124)their (4)them (5)themselves (2)then (5)there (16)these (4)they (12)thing (2)things (4)think (2)thinks (2)this (17)those (4)though (7)thousand (2)thousands (2)thump (2)time (6)to (53)two (4)under (2)unless (2)up (4)upon (9)voyage (6)warehouses (2)was (8)water (8)way (6)we (3)well (2)were (7)whale (3)whaling (5)what (9)when (5)whenever (5)where (2)which (4)who (5)why (7)wild (2)will (6)winds (3)with (13)without (3)world (4)would (4)yet (4)yonder (2)you (23)your (6) \ No newline at end of file diff --git a/test/plots/index.js b/test/plots/index.js index b5374429e7..e13b669ddd 100644 --- a/test/plots/index.js +++ b/test/plots/index.js @@ -64,6 +64,7 @@ export {default as letterFrequencyCloud} from "./letter-frequency-cloud.js"; export {default as letterFrequencyColumn} from "./letter-frequency-column.js"; export {default as letterFrequencyDot} from "./letter-frequency-dot.js"; export {default as letterFrequencyLollipop} from "./letter-frequency-lollipop.js"; +export {default as letterFrequencyWheel} from "./letter-frequency-wheel.js"; export {default as logDegenerate} from "./log-degenerate.js"; export {default as metroInequality} from "./metro-inequality.js"; export {default as metroInequalityChange} from "./metro-inequality-change.js"; diff --git a/test/plots/letter-frequency-wheel.js b/test/plots/letter-frequency-wheel.js new file mode 100644 index 0000000000..85832d8a6a --- /dev/null +++ b/test/plots/letter-frequency-wheel.js @@ -0,0 +1,40 @@ +import * as Plot from "@observablehq/plot"; +import * as d3 from "d3"; + +export default async function() { + let alphabet = await d3.csv("data/alphabet.csv", d3.autoType); + alphabet = d3.sort(alphabet, d => d.letter); + const m = d3.max(alphabet, d => d.frequency) * 1.1; + return Plot.plot({ + width: 500, + height: 250, + x: {axis: null, inset: 10}, + y: {axis: null, inset: 10}, + marks: [ + Plot.ruleY([0], {stroke: "#ccc"}), + Plot.link(alphabet, { + x1: () => 0, + y1: () => 0, + x2: (_, i) => -Math.cos((.5 + i) * Math.PI / 26) * _.frequency / m, + y2: (_, i) => Math.sin((.5 + i) * Math.PI / 26) * _.frequency / m, + stroke: "black", + strokeWidth: 2 + }), + Plot.text(alphabet, { + x: (_, i) => -Math.cos((.5 + i) * Math.PI / 26), + y: (_, i) => Math.sin((.5 + i) * Math.PI / 26), + text: "letter", + rotate: (_, i) => -90 + (.5 + i) * 180 / 26 + }), + Plot.text(alphabet, { + x: (_, i) => -Math.cos((.5 + i) * Math.PI / 26), + y: (_, i) => Math.sin((.5 + i) * Math.PI / 26), + text: d => `\n${(d.frequency * 100).toFixed(1)}%`, + lineAnchor: "top", + lineHeight: 1.1, + fontSize: 8, + rotate: (_, i) => -90 + (.5 + i) * 180 / 26 + }) + ] + }); +} diff --git a/test/plots/letter-wheel.js b/test/plots/letter-wheel.js new file mode 100644 index 0000000000..85832d8a6a --- /dev/null +++ b/test/plots/letter-wheel.js @@ -0,0 +1,40 @@ +import * as Plot from "@observablehq/plot"; +import * as d3 from "d3"; + +export default async function() { + let alphabet = await d3.csv("data/alphabet.csv", d3.autoType); + alphabet = d3.sort(alphabet, d => d.letter); + const m = d3.max(alphabet, d => d.frequency) * 1.1; + return Plot.plot({ + width: 500, + height: 250, + x: {axis: null, inset: 10}, + y: {axis: null, inset: 10}, + marks: [ + Plot.ruleY([0], {stroke: "#ccc"}), + Plot.link(alphabet, { + x1: () => 0, + y1: () => 0, + x2: (_, i) => -Math.cos((.5 + i) * Math.PI / 26) * _.frequency / m, + y2: (_, i) => Math.sin((.5 + i) * Math.PI / 26) * _.frequency / m, + stroke: "black", + strokeWidth: 2 + }), + Plot.text(alphabet, { + x: (_, i) => -Math.cos((.5 + i) * Math.PI / 26), + y: (_, i) => Math.sin((.5 + i) * Math.PI / 26), + text: "letter", + rotate: (_, i) => -90 + (.5 + i) * 180 / 26 + }), + Plot.text(alphabet, { + x: (_, i) => -Math.cos((.5 + i) * Math.PI / 26), + y: (_, i) => Math.sin((.5 + i) * Math.PI / 26), + text: d => `\n${(d.frequency * 100).toFixed(1)}%`, + lineAnchor: "top", + lineHeight: 1.1, + fontSize: 8, + rotate: (_, i) => -90 + (.5 + i) * 180 / 26 + }) + ] + }); +} From 2b067fad23004a56bde7377cdd5978456bc3d8f8 Mon Sep 17 00:00:00 2001 From: Mike Bostock Date: Wed, 19 Jan 2022 08:07:16 -0800 Subject: [PATCH 2/3] use selection.call to branch --- src/marks/text.js | 12 +++++------- test/output/caltrain.html | 4 ++-- test/output/simpsonsRatings.svg | 2 +- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/marks/text.js b/src/marks/text.js index 4388442f7d..9b843d99a9 100644 --- a/src/marks/text.js +++ b/src/marks/text.js @@ -62,20 +62,18 @@ export class Text extends Mark { .data(index) .join("text") .call(applyDirectStyles, this) - .attr("transform", R ? (X && Y ? i => `translate(${X[i]},${Y[i]}) rotate(${R[i]})` + .call(R ? text => text.attr("transform", X && Y ? i => `translate(${X[i]},${Y[i]}) rotate(${R[i]})` : X ? i => `translate(${X[i]},${cy}) rotate(${R[i]})` : Y ? i => `translate(${cx},${Y[i]}) rotate(${R[i]})` : i => `translate(${cx},${cy}) rotate(${R[i]})`) - : rotate ? (X && Y ? i => `translate(${X[i]},${Y[i]}) rotate(${rotate})` + : rotate ? text => text.attr("transform", X && Y ? i => `translate(${X[i]},${Y[i]}) rotate(${rotate})` : X ? i => `translate(${X[i]},${cy}) rotate(${rotate})` : Y ? i => `translate(${cx},${Y[i]}) rotate(${rotate})` : `translate(${cx},${cy}) rotate(${rotate})`) - : null) - .attr("x", (R || rotate) ? null : X ? i => X[i] : cx) - .attr("y", (R || rotate) ? null : Y ? i => Y[i] : cy) + : text => text.attr("x", X ? i => X[i] : cx).attr("y", Y ? i => Y[i] : cy)) .call(applyAttr, "font-size", FS && (i => FS[i])) - .call(applyChannelStyles, this, channels) - .call(applyMultilineText, this, T)) + .call(applyMultilineText, this, T) + .call(applyChannelStyles, this, channels)) .node(); } } diff --git a/test/output/caltrain.html b/test/output/caltrain.html index b6cae84850..66c7bbe137 100644 --- a/test/output/caltrain.html +++ b/test/output/caltrain.html @@ -49,8 +49,8 @@ Northbound Southbound 5a8p9p10p11p8a9a5p6p10a11a12p1p2p3p4p6a7a7p12a - 010101010105050506061011111116161616162123232324242436363636384141414141415454 - 010101020303030303030312121218181821252525262626263636363838384449495151515757 + 010101010105050506061011111116161616162123232324242436363636384141414141415454 + 010101020303030303030312121218181821252525262626263636363838384449495151515757 diff --git a/test/output/simpsonsRatings.svg b/test/output/simpsonsRatings.svg index ae88717ac1..86806a6b41 100644 --- a/test/output/simpsonsRatings.svg +++ b/test/output/simpsonsRatings.svg @@ -830,5 +830,5 @@ - 7.48.38.28.18.08.47.88.08.27.68.58.07.78.77.77.98.28.58.38.27.97.88.48.28.58.07.98.87.78.48.68.08.78.28.18.27.97.58.68.58.47.88.58.57.98.18.38.68.38.78.58.38.37.78.28.88.08.37.77.89.07.87.98.98.77.78.07.87.47.78.05.18.27.87.98.58.18.28.08.27.77.57.67.27.97.57.67.17.37.97.36.67.37.67.17.77.37.27.46.97.37.57.27.77.56.57.05.68.77.07.37.36.87.37.26.97.77.37.27.27.37.16.97.07.37.27.17.17.07.17.06.97.27.36.38.36.76.96.47.06.66.77.56.86.97.06.47.07.17.27.18.16.76.77.16.97.76.76.97.16.97.17.27.27.06.37.16.86.87.17.15.76.96.66.87.26.97.07.07.26.17.07.37.26.67.26.26.15.76.78.57.16.94.56.37.27.06.56.26.56.87.06.76.56.57.26.77.06.57.76.76.96.36.96.85.86.77.57.87.98.38.27.57.78.18.27.57.57.96.86.76.88.46.8---6.67.37.16.48.27.87.87.67.78.48.68.28.58.18.18.79.08.38.47.78.27.97.88.29.08.07.78.98.08.68.17.88.28.28.18.48.88.38.58.48.08.08.28.68.37.78.59.08.08.18.58.36.08.58.18.38.08.98.28.99.08.97.58.78.18.58.38.08.17.78.38.28.08.27.77.97.57.98.08.17.58.28.28.88.37.39.17.68.38.17.67.78.08.07.38.07.37.26.97.67.37.36.97.87.77.27.57.37.07.37.37.77.17.36.97.56.67.97.37.37.48.66.57.37.07.76.97.07.17.77.17.16.97.27.37.16.87.36.96.97.37.26.87.16.67.06.67.48.66.66.77.37.06.26.86.97.36.96.46.96.97.07.36.76.66.77.37.07.37.06.97.17.47.36.87.67.27.16.37.16.36.16.66.67.07.16.36.66.87.27.16.47.36.67.37.07.37.07.36.67.17.27.07.57.07.06.37.17.27.26.76.67.26.96.37.26.76.96.66.57.26.86.56.77.27.06.46.66.36.86.97.37.06.77.07.16.76.76.96.57.07.47.86.57.66.97.07.17.16.56.66.46.57.37.27.06.37.17.07.36.65.86.56.36.86.66.75.96.26.76.37.36.36.96.95.86.56.76.87.36.76.56.96.37.17.28.08.88.18.29.09.07.78.88.48.29.09.19.28.59.28.17.77.68.08.08.68.07.68.27.97.56.77.57.37.47.26.57.17.17.07.47.46.56.77.27.17.27.36.76.97.16.87.17.26.96.66.46.96.67.27.07.17.37.17.17.26.97.26.76.76.98.25.97.06.36.87.07.07.36.96.47.0 + 7.4Homer's Night Out8.3Krusty Gets Busted8.2Bart Gets an "F"8.1Two Cars in Every Garage and Three Eyes on Every Fish8.0Dead Putting Society8.4Bart the Daredevil7.8Bart Gets Hit by a Car8.0Homer vs. Lisa and the 8th Commandment8.2Oh Brother, Where Art Thou?7.6Old Money8.5Lisa's Substitute8.0Blood Feud7.7Mr. Lisa Goes to Washington8.7Bart the Murderer7.7Like Father, Like Clown7.9Saturdays of Thunder8.2Burns Verkaufen der Kraftwerk8.5Radio Bart8.3Bart the Lover8.2Separate Vocations7.9Colonel Homer7.8Bart's Friend Falls in Love8.4Kamp Krusty8.2Itchy & Scratchy: The Movie8.5Lisa's First Word8.0Selma's Choice7.9The Call of the Simpsons8.8One Fish, Two Fish, Blowfish, Blue Fish7.7Marge in Chains8.4Homer's Barbershop Quartet8.6Homer Goes to College8.0Marge on the Lam8.7Boy-Scoutz 'n the Hood8.2Homer the Vigilante8.1Bart Gets Famous8.2Lisa vs. Malibu Stacy7.9Bart Gets an Elephant7.5Lady Bouvier's Lover8.6Bart of Darkness8.5Itchy & Scratchy Land8.4Lisa on Ice7.8Fear of Flying8.5And Maggie Makes Three8.5Homie the Clown7.9Homer vs. Patty and Selma8.1Two Dozen and One Greyhounds8.3'Round Springfield8.6Lemon of Troy8.3Radioactive Man8.7Bart Sells His Soul8.5Treehouse of Horror VI8.3Marge Be Not Proud8.3Team Homer7.7Bart the Fink8.2New Kid on the Block8.822 Short Films About Springfield8.0Much Apu About Nothing8.3Summer of 4 Ft. 27.7Burns, Baby Burns7.8Lisa's Date with Density9.0The Springfield Files7.8The Twisted World of Marge Simpson7.9The Itchy & Scratchy & Poochie Show8.9Homer's Phobia8.7Homer vs. the Eighteenth Amendment7.7The Canine Mutiny8.0In Marge We Trust7.8The Secret War of Lisa Simpson7.4The Principal and the Pauper7.7Bart Star8.0Lisa the Skeptic5.1All Singing, All Dancing8.2The Joy of Sect7.8This Little Wiggy7.9The Trouble with Trillions8.5Trash of the Titans8.1Natural Born Kissers8.2The Wizard of Evergreen Terrace8.0Treehouse of Horror IX8.2Mayored to the Mob7.7Wild Barts Can't Be Broken7.5Make Room for Lisa7.6Mom and Pop Art7.2Monty Can't Buy Me Love7.9Thirty Minutes over Tokyo7.5Guess Who's Coming to Criticize Dinner?7.6E-I-E-I-(Annoyed Grunt)7.1Eight Misbehavin'7.3The Mansion Family7.9Alone Again, Natura-diddily7.3Pygmoelian6.6Kill the Alligator and Run7.3It's a Mad, Mad, Mad, Mad Marge7.6Treehouse of Horror XI7.1Insane Clown Poppy7.7The Computer Wore Menace Shoes7.3Pokey Mom7.2Day of the Jackanapes7.4Hungry, Hungry Homer6.9Simpson Safari7.3Children of a Lesser Clod7.5Treehouse of Horror XII7.2Homer the Moe7.7The Blunder Years7.5Half-Decent Proposal6.5The Lastest Gun in the West7.0Blame It on Lisa5.6Gump Roast8.7Homer's Triple Bypass7.0Bart vs. Lisa vs. the Third Grade7.3The Great Louse Detective7.3The Dad Who Knew Too Little6.8Pray Anything7.3C.E.D'oh7.2Three Gays of the Condo6.9Brake My Wife, Please7.7Moe Baby Blues7.3My Mother the Carjacker7.2The Fat and the Furriest7.2'Tis the Fifteenth Season7.3I, (Annoyed Grunt)-bot7.1Smart & Smarter6.9Co-Dependents' Day7.0Catch 'Em If You Can7.3The Way We Weren't7.2Fraudcast News7.1Sleeping with the Enemy7.1Fat Man and Little Boy7.0Mommie Beerest7.1There's Something About Marrying7.0Goo Goo Gai Pan6.9The Seven-Beer Snitch7.2The Heartbroke Kid7.3Thank God It's Doomsday6.3The Bonfire of the Manatees8.3Duffless6.7The Last of the Red Hat Mamas6.9Simpsons Christmas Stories6.4My Fair Laddy7.0Bart Has Two Mommies6.6Million-Dollar Abie6.7Regarding Margie7.5The Mook, the Chef, the Wife and Her Homer6.8Please Homer, Don't Hammer 'Em6.9G.I. (Annoyed Grunt)7.0Ice Cream of Margie (with the Light Blue Hair)6.4Kill Gil, Volumes I & II7.0Little Big Girl7.1Yokel Chords7.2Homerazzi7.1Crook and Ladder8.124 Minutes6.7The Homer of Seville6.7Little Orphan Millie7.1Funeral for a Fiend6.9E Pluribus Wiggum7.7The Debarted6.7Smoke on the Daughter6.9Apocalypse Cow7.1Mona Leaves-a6.9Lost Verizon7.1Treehouse of Horror XIX7.2So It's Come to This: A Simpsons Clip Show7.2Gone Maggie Gone7.0Father Knows Worst6.3Four Great Women and a Manicure7.1Homer the Whopper6.8Rednecks and Broomsticks6.8Thursdays with Abie7.1Million Dollar Maybe7.1Postcards from the Wedge5.7The Greatest Story Ever D'ohed6.9Moe Letter Blues6.6Judge Me Tender6.8Loan-a Lisa7.2Lisa Simpson, This Isn't Your Life6.9The Fight Before Christmas7.0Donnie Fatso7.0Homer the Father7.2Angry Dad: The Movie6.1A Midsummer's Nice Dream7.0The Great Simpsina7.3500 Keys7.2The Falcon and the D'ohman6.6Treehouse of Horror XXII7.2The Food Wife6.2The Ten-Per-Cent Solution6.1Politically Inept, with Homer Simpson5.7Moe Goes from Rags to Riches6.7Pranks and Greens8.5$pringfield (or, How I Learned to Stop Worrying and Love Legalized Gambling)7.1Beware My Cheating Bart6.9The Spy Who Learned Me4.5Lisa Goes Gaga6.3Penny-Wiseguys7.2To Cur with Love7.0A Test Before Trying6.5Love is a Many-Splintered Thing6.2Gorgeous Grampa6.5What Animated Women Want6.8Whiskey Business7.0Homerland6.7YOLO6.5The Kid Is All Right6.5White Christmas Blues7.2Specs and the City6.7The Man Who Grew Too Much7.0The War of Art6.5Luca$7.7Brick Like Me6.7The Yellow Badge of Cowardge6.9The Wreck of the Relationship6.3Opposites A-Frack6.9Blazed and Confused6.8The Man Who Came to Be Dinner5.8The Musk Who Fell to Earth6.7Peeping Mom7.5Life on the Fast Lane7.8The Crepes of Wrath7.9Some Enchanted Evening8.3Simpson and Delilah8.2Treehouse of Horror7.5Dancin' Homer7.7Bart vs. Thanksgiving8.1Itchy & Scratchy & Marge8.2The Way We Was7.5Principal Charming7.5Bart's Dog Gets an "F"7.9The War of the Simpsons6.8Bull-E6.7Cue Detective6.8Friend with Benefit8.4Barthood6.8Teenage Mutant Milk-Caused Hurdles-Friends and Family"[203]-The Town"[205]-Treehouse of Horror XXVII"[207]6.6Gal of Constant Sorrow7.3The Marge-ian Chronicles7.1Fland Canyon6.4Simprovised8.2Simpsons Roasting on an Open Fire7.8Bart the Genius7.8There's No Disgrace Like Home7.6Moaning Lisa7.7The Telltale Head8.4Three Men and a Comic Book8.6Stark Raving Dad8.2When Flanders Failed8.5Homer Defined8.1The Front8.1Brother from the Same Planet8.7Treehouse of Horror IV9.0Marge vs. the Monorail8.3I Love Lisa8.4The Last Temptation of Homer7.7Dog of Death8.2Treehouse of Horror II7.9Lisa's Pony7.8Marge Gets a Job8.2I Married Marge9.0Last Exit to Springfield8.0Lisa the Greek7.7The Otto Show8.9Rosebud8.0Homer Alone8.6Homer at the Bat8.1Whacking Day7.8Lisa the Beauty Queen8.2Krusty Gets Kancelled8.2Black Widower8.1A Streetcar Named Marge8.4Treehouse of Horror III8.8Mr. Plow8.3Homer and Apu8.5Homer Loves Flanders8.4Burns' Heir8.0Sideshow Bob's Last Gleaming8.0Grampa vs. Sexual Inadequacy8.2A Fish Called Selma8.6Bart's Comet8.3Home Sweet Homediddly-Dum-Doodily7.7Scenes from the Class Struggle in Springfield8.5Bart vs. Australia9.0King-Size Homer8.0Secrets of a Successful Marriage8.1Lisa's Rival8.5A Star Is Burns8.3Lisa's Wedding6.0Another Simpsons Clip Show8.5Lisa the Vegetarian8.1The PTA Disbands8.3Sideshow Bob Roberts8.0Bart's Girlfriend8.9Who Shot Mr. Burns? (Part Two)8.2The Springfield Connection8.9Homer the Smithers9.0Homer Badman8.9Homer the Great7.5The Simpsons 138th Episode Spectacular8.7Two Bad Neighbors8.1Lisa the Iconoclast8.5Mother Simpson8.3Raging Abe Simpson and His Grumbling Grandson in "The Curse of the Flying Hellfish"8.0Homerpalooza8.1Lisa's Sax7.7Simpsoncalifragilisticexpiala(Annoyed Grunt)cious8.3Treehouse of Horror VII8.2Brother from Another Series8.0The Homer They Fall8.2Bart After Dark7.7Lost Our Lisa7.9Girly Edition7.5Realty Bites7.9The Old Man and the Lisa8.0A Milhouse Divided8.1My Sister, My Sitter7.5The Last Temptation of Krust8.2The Cartridge Family8.2Grade School Confidential8.8Hurricane Neddy8.3Simpson Tide7.3The Simpsons Spin-Off Showcase9.1The City of New York vs. Homer Simpson7.6Miracle on Evergreen Terrace8.3King of the Hill8.1Das Bus7.6Lard of the Dance7.7Bart Carny8.0Lisa the Simpson8.0The Day the Violence Died7.3When You Dish Upon a Star8.0Lisa Gets an "A"7.3Homer Simpson in: "Kidney Trouble"7.2Lisa the Tree Hugger6.9Sunday, Cruddy Sunday7.6Maximum Homerdrive7.3Hello Gutter, Hello Fadder7.3Simpsons Bible Stories6.9Tennis the Menace7.8Viva Ned Flanders7.7Treehouse of Horror X7.2Last Tap Dance in Springfield7.5Brother's Little Helper7.3The Old Man and the "C" Student7.0Bart to the Future7.3Beyond Blunderdome7.3They Saved Lisa's Brain7.7Homer to the Max7.1Take My Wife, Sleaze7.3Little Big Mom6.9Faith Off7.5Worst Episode Ever6.6Saddlesore Galactica7.9Behind the Laughter7.3The Great Money Caper7.3Missionary: Impossible7.4Days of Wine and D'oh'ses8.6Bart on the Road6.5Bye, Bye, Nerdie7.3I'm Goin' to Praiseland7.0Simpsons Tall Tales7.7I Am Furious (Yellow)6.9The Sweetest Apu7.0The President Wore Pearls7.1The Parent Rap7.7Weekend at Burnsie's7.1Large Marge7.1The Bart Wants What It Wants6.9Mr. Spritz Goes to Washington7.2A Hunka Hunka Burns in Love7.3How I Spent My Strummer Vacation7.1She of Little Faith6.8Helter Shelter7.3Tales from the Public Domain6.9The Strong Arms of the Ma6.9Brawl in the Family7.3Jaws Wired Shut7.2Little Girl in the Big Ten6.8Old Yeller-Belly7.1Special Edna6.6Barting Over7.0Dude, Where's My Ranch?6.6The Bart of War7.4Treehouse of Horror XIV8.6Mountain of Madness6.6Today I Am a Clown6.7Marge vs. Singles, Seniors, Childless Couples and Teens and Gays7.3Diatribe of a Mad Housewife7.0All's Fair in Oven War6.2Bart-Mangled Banner6.8A Star Is Torn6.9See Homer Run7.3Milhouse Doesn't Live Here Anymore6.9The Ziff Who Came to Dinner6.4Homer and Ned's Hail Mary Pass6.9The Girl Who Slept Too Little6.9The Wandering Juvie7.0Milhouse of Sand and Fog7.3Treehouse of Horror XVI6.7Homer's Paternity Coot6.6She Used to Be My Girl6.7My Big Fat Geek Wedding7.3Future-Drama7.0The Italian Bob7.3Simple Simpson7.0We're on the Road to D'ohwhere6.9On a Clear Day I Can't See My Sister7.1Home Away from Homer7.4Treehouse of Horror XV7.3Midnight Rx6.8Pranksta Rap7.6Dumbbell Indemnity7.2Girls Just Want to Have Sums7.1The Monkey Suit6.3The Boys of Bummer7.1Treehouse of Horror XVIII6.3Rome-Old and Juli-Eh6.1Papa Don't Leech6.6Marge and Homer Turn a Couple Play6.6The Wife Aquatic7.0Double, Double, Boy in Trouble7.1Treehouse of Horror XVII6.3That '90s Show6.6The Burns and the Bees6.8Moe'N'a Lisa7.2The Haw-Hawed Couple7.1Husbands and Knives6.4All About Lisa7.3You Kent Always Say What You Want6.6Dangerous Curves7.3Springfield Up7.0Revenge Is a Dish Best Served Three Times7.3Marge Gamer7.0Stop! Or My Dog Will Shoot7.3Dial 'N' for Nerder6.6Love, Springfieldian Style7.1MyPods and Boomsticks7.2Sex, Pies and Idiot Scrapes7.0Any Given Sundance7.5Bart the Mother7.0Take My Life, Please7.0No Loan Again, Naturally6.3Elementary School Musical7.1Waverly Hills, 9-0-2-1-D'oh7.2The Bob Next Door7.2The Good, the Sad and the Drugly6.7Once Upon a Time in Springfield6.6Bart Gets a 'Z'7.2Eeny Teeny Maya Moe6.9Chief of Hearts6.3The Great Wife Hope7.2To Surveil with Love6.7The Scorpion's Tale6.9The Blue and the Gray6.6The Color Yellow6.5The Fool Monty7.2O Brother, Where Bart Thou?6.8Boy Meets Curl6.5Love Is a Many Strangled Thing6.7The Devil Wears Nada7.2Homer Scissorhands7.0Stealing First Base6.4How Munched is That Birdie in the Window?6.6The Real Housewives of Fat Tony6.3Moms I'd Like to Forget6.8MoneyBart6.9Flaming Moe7.3I'm with Cupid7.0Bart Stops to Smell the Roosevelts6.7Replaceable You7.0The D'oh-cial Network7.1Married to the Blob6.7Ned 'n Edna's Blend6.7Gone Abie Gone6.9Homer Goes to Prep School6.5Four Regrettings and a Funeral7.0Yellow Subterfuge7.4A Totally Fun Thing That Bart Will Never Do Again7.8The Book Job6.5The Daughter Also Rises7.6Steal This Episode6.9Exit Through the Kwik-E-Mart7.0Black Eyed, Please7.1Them, Robot7.1Treehouse of Horror XXIV6.5Pulpit Friction6.6The Changing of the Guardian6.4Moonshine River6.5A Tree Grows in Springfield7.3Treehouse of Horror XXIII7.2The Day the Earth Stood Cool7.0Hardly Kirk-ing6.3The Fabulous Faker Boy7.1Labor Pains7.0Dangers on a Train7.3Marge Simpson in: "Screaming Yellow Honkers"6.6The Winter of His Content5.8What to Expect When Bart's Expecting6.5Covercraft6.3Walking Big & Tall6.8Treehouse of Horror XXVI6.6The Girl Code6.7Pay Pal5.9Every Man's Dream6.2Let's Go Fly a Coot6.7Waiting for Duffman6.3Lisa with an 'S'7.3Bart's New Friend6.3Love Is in the N2-O2-Ar-CO2-Ne-He-CH46.9The Kids Are All Fight6.9Sky Police5.8Clown in the Dumps6.5Super Franchise Me6.7Much Apu About Something6.8I Won't Be Home for Christmas7.3Treehouse of Horror XXV6.7My Fare Lady6.5The Burns Cage6.9Mathlete's Feat6.3Lisa the Veterinarian7.1Paths of Glory7.2Puffless8.0Brush with Greatness8.8Flaming Moe's8.1Bart the General8.2Brother, Can You Spare Two Dimes?9.0Homer the Heretic9.0Cape Feare7.7Bart's Inner Child8.8Deep Space Homer8.4Sweet Seymour Skinner's Baadasssss Song8.2The Boy Who Knew Too Much9.0Treehouse of Horror V9.1Who Shot Mr. Burns? (Part One)9.2You Only Move Twice8.5El Viaje Misterioso de Nuestro Jomer (The Mysterious Voyage of Homer)9.2Homer's Enemy8.1Treehouse of Horror VIII7.7The Two Mrs. Nahasapeemapetilons7.6D'oh-in' in the Wind8.0Skinner's Sense of Snow8.0HOMR8.6Trilogy of Error8.0Poppa's Got a Brand New Badge7.6Treehouse of Horror XIII8.2Holidays of Future Passed7.9Simpsorama7.5Halloween of Horror6.7To Courier with Love7.5Homer's Odyssey7.3Grift of the Magi7.4A Tale of Two Springfields7.2Homer vs. Dignity6.5The Old Man and the Key7.1'Scuse Me While I Miss the Sky7.1Margical History Tour7.0Mobile Homer7.4Don't Fear the Roofer7.4The Seemingly Never-Ending Story6.5Homer Simpson, This Is Your Wife6.7The Wettest Stories Ever Told7.2Midnight Towboy7.1Homer and Lisa Exchange Cross Words7.2Coming to Homerica7.3Treehouse of Horror XX6.7American History X-cellent6.9The Squirt and the Whale7.1Treehouse of Horror XXI6.8The Man in the Blue Flannel Pants7.1Dark Knight Court7.2The Saga of Carl6.9You Don't Have to Live Like a Referee6.6The Princess Guide6.4How Lisa Got Her Marge Back6.9Orange Is the New Yellow6.6Monty Burns' Fleeing Circus7.2New Kids on the Blecch7.0Sweets and Sour Marge7.1The Frying Game7.3I'm Spelling As Fast As I Can7.1A Star Is Born-Again7.1The Regina Monologues7.2The Father, the Son, and the Holy Guest Star6.9Marge's Son Poisoning7.2Kiss Kiss, Bang Bangalore6.7Jazzy and the Pussycats6.7He Loves to Fly and He D'ohs6.9I Don't Wanna Know Why the Caged Bird Sings8.2Eternal Moonshine of the Simpson Mind5.9Lisa the Drama Queen7.0How the Test Was Won6.3In the Name of the Grandfather6.8Wedding for Disaster7.0The Ned-Liest Catch7.0At Long Last Leave7.3How I Wet Your Mother6.9Adventures in Baby-Getting6.4Diggs7.0Days of Future Future \ No newline at end of file From fa4aa6aa3b3b691c7433f162034fc30d54f435b4 Mon Sep 17 00:00:00 2001 From: Mike Bostock Date: Wed, 19 Jan 2022 08:09:23 -0800 Subject: [PATCH 3/3] remove duplicate test --- test/plots/letter-wheel.js | 40 -------------------------------------- 1 file changed, 40 deletions(-) delete mode 100644 test/plots/letter-wheel.js diff --git a/test/plots/letter-wheel.js b/test/plots/letter-wheel.js deleted file mode 100644 index 85832d8a6a..0000000000 --- a/test/plots/letter-wheel.js +++ /dev/null @@ -1,40 +0,0 @@ -import * as Plot from "@observablehq/plot"; -import * as d3 from "d3"; - -export default async function() { - let alphabet = await d3.csv("data/alphabet.csv", d3.autoType); - alphabet = d3.sort(alphabet, d => d.letter); - const m = d3.max(alphabet, d => d.frequency) * 1.1; - return Plot.plot({ - width: 500, - height: 250, - x: {axis: null, inset: 10}, - y: {axis: null, inset: 10}, - marks: [ - Plot.ruleY([0], {stroke: "#ccc"}), - Plot.link(alphabet, { - x1: () => 0, - y1: () => 0, - x2: (_, i) => -Math.cos((.5 + i) * Math.PI / 26) * _.frequency / m, - y2: (_, i) => Math.sin((.5 + i) * Math.PI / 26) * _.frequency / m, - stroke: "black", - strokeWidth: 2 - }), - Plot.text(alphabet, { - x: (_, i) => -Math.cos((.5 + i) * Math.PI / 26), - y: (_, i) => Math.sin((.5 + i) * Math.PI / 26), - text: "letter", - rotate: (_, i) => -90 + (.5 + i) * 180 / 26 - }), - Plot.text(alphabet, { - x: (_, i) => -Math.cos((.5 + i) * Math.PI / 26), - y: (_, i) => Math.sin((.5 + i) * Math.PI / 26), - text: d => `\n${(d.frequency * 100).toFixed(1)}%`, - lineAnchor: "top", - lineHeight: 1.1, - fontSize: 8, - rotate: (_, i) => -90 + (.5 + i) * 180 / 26 - }) - ] - }); -}