Published
Edited
Jul 23, 2020
Importers
7 stars
Insert cell
Insert cell
Insert cell
table(WilkinsonTable)
Insert cell
rawTable = `Continuum,Exponent,Stimulus condition
Angular acceleration,1.4,5 s rotation
Brightness,0.33,5° target in dark
Brightness,0.5,Point source
Brightness,0.5,Brief flash
"Discomfort, cold",1.7,Whole-body irradiation
Duration,1.1,White-noise stimuli
Electric shock,3.5,Current through fingers
Finger span,1.3,Thickness of blocks
Heaviness,1.45,Lifted weights
Lightness,1.2,Reflectance of gray papers
Loudness,0.67,Sound pressure of 3000 Hz tone
Muscle force,1.7,Static contractions
Pressure on palm,1.1,Static force on skin
Redness (saturation),1.7,Red–gray mixture
Smell,0.6,Heptane
Tactual hardness,0.8,Squeezing rubber
Tactual roughness,1.5,Rubbing emery cloths
Taste,1.3,Sucrose
Taste,1.4,Salt
Taste,0.8,Saccharin
Vibration,0.95,Amplitude of 60 Hz on finger
Vibration,0.6,Amplitude of 250 Hz on finger
Viscosity,0.42,Stirring silicone fluids
Visual area,0.7,Projected square
Visual length,1,Projected line
Vocal effort,1.1,Vocal sound pressure
Warmth,1.6,Metal contact on arm
Warmth,1.3,"Irradiation of skin, small area"
Warmth,0.7,"Irradiation of skin, large area"`
Insert cell
WilkinsonTable = d3.csvParse(rawTable, d3.autoType)
Insert cell
md`Generate points to draw each function`
Insert cell
data = WilkinsonTable
.map(row =>
Array.from({length: CLIP_X*STEP})
.map((_,i) =>
({...row,
x: i/STEP,
y:(i/STEP)**row.Exponent,
Condition: row.Continuum + " " + row["Stimulus condition"]
})
)
).flat()
Insert cell
IDsWithLabels =[
"Electric shock Current through fingers",
"Visual area Projected square",
"Visual length Projected line",
"Brightness 5° target in dark",
]
Insert cell
maxX = d3.rollup(
data.filter(d => d.y < CLIP_X && d.x < CLIP_X && IDsWithLabels.indexOf(d.Condition) !== -1),
v => d3.max(v, d => d.y),
d=> d.Condition)
Insert cell
CLIP_X = 5
Insert cell
STEP = 20
Insert cell
data.filter(d => d.y === maxX.get(d.Condition))
Insert cell
d3 = require("d3-dsv", "d3-array")
Insert cell
import {table} from "@tmcw/tables"

Insert cell
import {vl} from "@vega/vega-lite-api"
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