# Chloropeth one-liner, AKA USA county map

**URL:** <https://talk.observablehq.com/t/chloropeth-one-liner-aka-usa-county-map/4617>\
**Category:** Show and tell\
**Created:** [February 10, 2021, 3:42am UTC](https://talk.observablehq.com/t/chloropeth-one-liner-aka-usa-county-map/4617 "2021-02-10T03:42:41Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![chonghorizons](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/chonghorizons/32/4172_2.png) [@chonghorizons](https://talk.observablehq.com/u/chonghorizons)\
**Post date:** [February 10, 2021, 3:42am UTC](https://talk.observablehq.com/t/chloropeth-one-liner-aka-usa-county-map/4617/1 "2021-02-10T03:42:41Z")

</div>

Inspired by @severo and his histogram one-liner, I made a chloropeth (US county map) one-liner notebook:

> **[Chloropeth one-liner, with import](https://observablehq.com/@chonghorizons/chloropeth-one-liner-with-import)**
>
> Made some adjustments to The main one line of code, using the "with" Inspired by the histogram one-liner by @severo: https://observablehq.com/@severo/tip-quick-histogram import { chart } with { COVIDformattedData as data, colorCovid as color,...

> **[try one liner chloropeth](https://observablehq.com/d/634734469aae6898)**
>
> sample of how to map a county map with just one line. ObservableHQ is awesome! Tip with importing data See https://observablehq.com/@observablehq/introduction-to-data#flare for how to import your data in. Or see...

It uses the awesome `with` syntax for `imports`. from [Introduction to Imports / Observable / Observable](https://observablehq.com/@observablehq/introduction-to-imports)

---

<div class="post-metadata">

**Author:** ![aaronkyle](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/aaronkyle/32/8106_2.png) [@aaronkyle](https://talk.observablehq.com/u/aaronkyle)\
**Post date:** [February 10, 2021, 5:54am UTC](https://talk.observablehq.com/t/chloropeth-one-liner-aka-usa-county-map/4617/2 "2021-02-10T05:54:44Z")

</div>

Woah! I somehow missed that not only can you `import {something as another_name}`, you can also reverse this as `import {this_notebook_data as original_data}`

[or am I hallucinating?]

---

<div class="post-metadata">

**Author:** ![Cobus](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/cobus/32/9670_2.png) [@Cobus](https://talk.observablehq.com/u/Cobus)\
**Post date:** [February 10, 2021, 6:42am UTC](https://talk.observablehq.com/t/chloropeth-one-liner-aka-usa-county-map/4617/3 "2021-02-10T06:42:37Z")

</div>

If you are referring to the fact that you can use this\_notebook’s data as the data when rendering the imported cell, then you are not hallucinating 🙂

So, ` import {chart as treemap} with {treemap_data as data} from "@d3/treemap"`

would use the treemap\_data from your notebook in place of the data in the imported notebook when rendering chart as treemap.

---

<div class="post-metadata">

**Author:** ![Cobus](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/cobus/32/9670_2.png) [@Cobus](https://talk.observablehq.com/u/Cobus)\
**Post date:** [February 10, 2021, 6:46am UTC](https://talk.observablehq.com/t/chloropeth-one-liner-aka-usa-county-map/4617/4 "2021-02-10T06:46:49Z")

</div>

Although, I have to say that I love the `importCell` method from [this notebook](https://observablehq.com/@mbostock/dataflow) very much… it imports and displays in a single cell.

---

<div class="post-metadata">

**Author:** ![MarioDelgadoSr](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/mariodelgadosr/32/1828_2.png) [@MarioDelgadoSr](https://talk.observablehq.com/u/MarioDelgadoSr)\
**Post date:** [February 26, 2021, 7:47pm UTC](https://talk.observablehq.com/t/chloropeth-one-liner-aka-usa-county-map/4617/5 "2021-02-26T19:47:47Z")

</div>

I _ **see** _ your _ **chart** _ one-liner and raise you an _ **app** _ 🙂 :

> **[Sankey Quick Start App](https://observablehq.com/@mariodelgadosr/sankey-quick-start-app)**
>
> Sankey Quick Start made into a one-liner app using import's with option. Usage: import {sankeyApp} with {YourData as data} from "@mariodelgadosr/sankey-quick-start-app" Where: YourData is a data table relative to your notebook formatted as:...

---

<div class="post-metadata">

**Author:** ![chonghorizons](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/chonghorizons/32/4172_2.png) [@chonghorizons](https://talk.observablehq.com/u/chonghorizons)\
**Post date:** [March 3, 2021, 12:56am UTC](https://talk.observablehq.com/t/chloropeth-one-liner-aka-usa-county-map/4617/6 "2021-03-03T00:56:48Z")

</div>

I like it. I don’t use Sankeys very much, unfortunately.

---

<div class="post-metadata">

**Author:** ![MarioDelgadoSr](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/mariodelgadosr/32/1828_2.png) [@MarioDelgadoSr](https://talk.observablehq.com/u/MarioDelgadoSr)\
**Post date:** [March 3, 2021, 7:28am UTC](https://talk.observablehq.com/t/chloropeth-one-liner-aka-usa-county-map/4617/7 "2021-03-03T07:28:52Z")

</div>

Note that this is an application with data-driven logic and UI as a function of the data passed to it. The pattern can be adopted for other applications.
