Published
Edited
Apr 22, 2020
Importers
Insert cell
Insert cell
Insert cell
Insert cell
data = {

const allData = (d3.csvParse(await FileAttachment("blackbody_vs_real_emission@1.csv").text(), d3.autoType))
.map(({ SpectralPower, Wavelength, Material}) => ({Material, iso: Material, Property_name: "Emissivity Power", Property: SpectralPower, Wavelength: Wavelength }))

return [
allData.filter(({ iso }) => iso === 'Blackbody'),
allData.filter(({ iso }) => iso === 'Real surface')

]

}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
/*xScale = {
var temp = [];
data.forEach(d=>d.forEach(e=>temp.push(e.Wavelength)))
const startWavelength = 0 //d3.min(temp);
const endWavelength = 8 //d3.max(temp);
return d3.scaleLinear( [ 0, 8])
//return d3.scaleLog().domain(d3.extent(temp)).range([margin.left, width - margin.right])
} */
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.scaleLinear(
[ startWavelength, endWavelength ],
[ margin.left, width - margin.right ]
)
}
Insert cell
yScale = {
return d3.scaleLinear(
[ 0, 7 ],
[ height - margin.bottom, margin.top ]
)
}
Insert cell
xAxis = d3.axisBottom(xScale)
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
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