Published
Edited
Jan 28, 2021
1 star
Insert cell
md`# Formatting log axis with scientific notation with Vega Lite

This copies from https://observablehq.com/@uwdata/scales-axes-and-legends

GOAL: Display the log scale with scientific notation`


Insert cell
import {vl} from "@vega/vega-lite-api"
Insert cell
antibiotics = (await require('vega-datasets@1'))['burtin.json'].url
Insert cell
md `### Original

from https://observablehq.com/@uwdata/scales-axes-and-legends`
Insert cell
vl.markCircle().data(antibiotics).encode(
vl.x().fieldQ('Neomycin')
.scale({type: 'log'})
).render()
Insert cell
Insert cell
vl.markCircle().data(antibiotics).encode(
vl.x().fieldQ('Neomycin')
.scale({type: 'log'})
.axis({format: ".2e"})
).render()
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more