Published
Edited
Apr 7, 2020
Insert cell
Insert cell
Insert cell
Insert cell
data = {

const allData = (d3.csvParse(await FileAttachment("12.22_reflectivity@3.csv").text(), d3.autoType))
.map(({ Reflectivity, Wavelength, Material}) => ({Material, iso: Material, Property: Reflectivity, Wavelength: Wavelength }))

return [
allData.filter(({ iso }) => iso === 'Fused quartz over aluminum substrate'),
allData.filter(({ iso }) => iso === 'Stainless steel, as received, dull'),
allData.filter(({ iso }) => iso === 'White paint'),
allData.filter(({ iso }) => iso === 'Aluminum evaporated film'),
allData.filter(({ iso }) => iso === 'Snow'),
allData.filter(({ iso }) => iso === 'Human skin, Caucasian'),
allData.filter(({ iso }) => iso === 'Red brick'),
allData.filter(({ iso }) => iso === 'Black paint'),

]

}
Insert cell
Insert cell
Insert cell
Insert cell
data2 = [[{"Material":"something"},{"Material":"somethingElSe"}]]
Insert cell
colors = {

const Material = data.map(d => d[0].Material)

return d3.scaleOrdinal(
Material,
d3.schemeSet2
)

}
Insert cell
data
Insert cell
data.filter(d=>d.Material=="Fused quartz over aluminum substrate")
Insert cell
xScale = {
var temp = [];
data.forEach(d=>d.forEach(e=>temp.push(e.Wavelength)))
const startWavelength = d3.min(temp);
const endWavelength = d3.max(temp);
return d3.scaleLog().domain(d3.extent(temp)).range([margin.left, width - margin.right])
}
Insert cell
yScale = {
return d3.scaleLinear(
[ 0, 1 ],
[ height - margin.bottom, margin.top ]
)
}
Insert cell
logFormat10 = xScale.tickFormat(10, "")
Insert cell
xScale.ticks(10).map(logFormat10)
Insert cell
xAxis = d3.axisBottom(xScale.copy().range([10, width - 10])).tickFormat(logFormat10)
Insert cell
yAxis = d3.axisLeft(yScale)
Insert cell
line = d3.line()
.x(d => xScale(d.Wavelength))
.y(d => yScale(d.Property))
.curve(d3.curveBasis)
Insert cell
materials = ["Fused quartz over aluminum substrate", "Stainless steel, as received, dull", "White paint", "Aluminum evaporated film"]
Insert cell
Insert cell
Insert cell
import {radio} from "@jashkenas/inputs"
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more