개요 / Overview
Observable Plot은 D3.js의 창시자인 마이크 보스톡(Mike Bostock)과 Observable 팀이 만든 탐색적 데이터 시각화를 위한 JavaScript 라이브러리입니다. 이는 "사용 편의성이 최우선 설계 목표였다면 D3는 어떤 모습이었을까?"라는 질문에 대한 보스톡의 답이라 할 수 있습니다. 그 결과물은 단 몇 줄의 코드로 정교한 통계 그래픽을 만들어내는 간결하고 고수준의 API입니다.
Observable Plot is a JavaScript library for exploratory data visualization, created by Mike Bostock (the creator of D3.js) and the team at Observable. It represents Bostock's answer to the question: "What would D3 look like if ease of use were the primary design goal?" The result is a concise, high-level API that produces sophisticated statistical graphics in just a few lines of code.
Plot은 (R의 ggplot2와 유사한) 그래픽 문법 패러다임을 따르며, 시각화는 마크(막대, 점, 선 같은 기하학적 요소)가 데이터 채널(x, y, 색상, 크기)에 매핑되어 구성됩니다. 하지만 ggplot2와 달리, Plot은 JavaScript 생태계를 위해 설계되었으며 브라우저에서 SVG로 렌더링됩니다. 스케일, 축, 범례, 레이블에 대해 영리한 선택을 자동으로 내려주므로, 기본값만으로도 거의 항상 좋아 보입니다.
Plot follows the grammar-of-graphics paradigm (similar to ggplot2 in R) where visualizations are composed of marks (geometric elements like bars, dots, lines) mapped to data channels (x, y, color, size). But unlike ggplot2, Plot is designed for the JavaScript ecosystem and renders to SVG in the browser. It makes smart choices about scales, axes, legends, and labels automatically, so the defaults almost always look good.
Observable Plot은 Observable 노트북(이 회사의 계산 노트북 플랫폼)과 자연스럽게 통합되지만, 어떤 JavaScript 프로젝트에서든 독립형 라이브러리로도 똑같이 잘 작동합니다. 오픈소스(ISC 라이선스)이며 npm으로 설치할 수 있습니다.
Observable Plot integrates naturally with Observable notebooks (the company's computational notebook platform) but works equally well as a standalone library in any JavaScript project. It is open-source (ISC license) and available via npm.
강점 / Strengths
- 매우 간결한 API — 5~10줄의 코드로 복잡한 차트 작성
- Extremely concise API — complex charts in 5-10 lines of code
- 스케일, 축, 색상, 범례에 대한 영리한 기본값
- Smart defaults for scales, axes, colors, and legends
- 그래픽 문법 접근 방식으로 조합 가능하고 레이어드된 시각화 구현
- Grammar-of-graphics approach enables composable, layered visualizations
- 내장 통계 변환: bin, group, stack, normalize, window, tree
- Built-in statistical transforms: bin, group, stack, normalize, window, tree
- 패싯팅(스몰 멀티플)이 일급 기능으로 지원됨
- Faceting (small multiples) is a first-class feature
- 시간형 및 범주형 데이터의 뛰어난 처리
- Excellent handling of temporal and categorical data
- 깔끔한 SVG로 렌더링되어 CSS로 쉽게 스타일링 가능
- Renders to clean SVG, easy to style with CSS
- 가볍고(~100KB) 의존성이 전혀 없음
- Lightweight (~100KB) with zero dependencies
- D3 창시자가 만들어 시각화 모범 사례에 깊이 기반함
- Created by the D3 creator — deeply informed by visualization best practices
- Observable 노트북, React, Svelte, 또는 일반 HTML에서 모두 작동
- Works in Observable notebooks, React, Svelte, or plain HTML
한계 / Limitations
- 제한적인 인터랙티비티 — 주로 정적 SVG를 생성(Plot.tip 마크로 툴팁 제공)
- Limited interactivity — primarily produces static SVGs (tooltips via Plot.tip mark)
- 비교적 신생(2021년)이라 커뮤니티와 생태계가 아직 성장 중
- Relatively new (2021), so the community and ecosystem are still growing
- 애니메이션과 전환 효과가 내장되어 있지 않음
- Animation and transitions are not built in
- D3에 비해 저수준 세부 사항에 대한 제어가 적음
- Less control over low-level details compared to D3
- 문서는 좋은 편이지만 성숙한 라이브러리에 비해 커뮤니티 튜토리얼이 적음
- Documentation, while good, has fewer community tutorials than mature libraries
- 집계 없이는 대규모 데이터셋(10만 포인트 초과)에 이상적이지 않음
- Not ideal for large datasets (>100K points) without aggregation
- 대시보드 레이아웃과 다중 차트 조정에는 외부 솔루션이 필요함
- Dashboard layout and multi-chart coordination require external solutions
- PNG/PDF로의 내장 내보내기 기능 없음 — 추가 도구 필요
- No built-in export to PNG/PDF — requires additional tools
이런 용도에 최적 / Best For
Observable Plot은 웹 네이티브 출력과 함께 ggplot2 스타일 명세의 속도를 원하는, JavaScript로 작업하는 데이터 과학자와 분석가에게 이상적입니다. Observable 노트북 내에서의 탐색적 데이터 분석, 통계 그래픽의 빠른 프로토타이핑, 최소한의 설정으로 "그냥 작동하는" 차트를 원하는 상황에서 탁월합니다. 일상적인 차트 작업에 D3가 너무 장황하다고 느끼지만 차트 라이브러리가 제공하는 것보다 더 많은 유연성이 필요하다면, Plot이 그 중간 지점입니다.
Observable Plot is ideal for data scientists and analysts working in JavaScript who want the speed of ggplot2-style specification with web-native output. It excels in exploratory data analysis within Observable notebooks, rapid prototyping of statistical graphics, and situations where you want a chart that "just works" with minimal configuration. If you find D3 too verbose for everyday charts but need more flexibility than a charting library provides, Plot is the sweet spot.
시작하기 / Getting Started
npm으로 설치합니다:
Install via npm:
npm install @observablehq/plot
첫 차트를 만들어봅니다:
Create your first chart:
import * as Plot from "@observablehq/plot";
// In a browser or Observable notebook
const chart = Plot.plot({
marks: [
Plot.barY(data, Plot.groupX({ y: "count" }, { x: "category" })),
Plot.ruleY([0])
]
});
document.getElementById("chart").append(chart);
색상 인코딩과 회귀선이 있는 산점도:
A scatterplot with color encoding and regression line:
Plot.plot({
color: { legend: true },
marks: [
Plot.dot(penguins, {
x: "culmen_length_mm",
y: "body_mass_g",
fill: "species"
}),
Plot.linearRegressionY(penguins, {
x: "culmen_length_mm",
y: "body_mass_g",
stroke: "species"
})
]
});
지원 차트 유형 / Supported Chart Types
Observable Plot은 막대 차트, 누적 막대 차트, 선 그래프, (누적형과 스트림그래프를 포함한) 영역 그래프, 산점도, 버블 차트, 히스토그램, (cell과 rect 마크를 통한) 히트맵, (rule과 tick 마크를 통한) 박스 플롯, 점 도표, 기울기 차트, 헥스빈 플롯, 밀도 등고선, 스몰 멀티플/패싯 차트를 다룹니다. 또한 코로플레스 맵을 위한 지리적 마크, 트리/계층 레이아웃, 링크 다이어그램도 지원합니다. 조합 가능한 마크 시스템을 통해, 명시적으로 내장되지 않은 많은 차트 유형(롤리팝 차트나 덤벨 플롯 등)도 기본 요소로부터 조립할 수 있습니다.
Observable Plot handles bar charts, stacked bar charts, line graphs, area graphs (including stacked and streamgraph), scatterplots, bubble charts, histograms, heatmaps (via cell and rect marks), box plots (via rule and tick marks), dot plots, slope charts, hexbin plots, density contours, and small multiples/faceted charts. It also supports geographic marks for choropleth maps, tree/hierarchical layouts, and link diagrams. Through its composable mark system, many chart types not explicitly built in (like lollipop charts or dumbbell plots) can be assembled from primitives.