Public
Edited
Oct 3, 2024
Insert cell
Insert cell
viewof file = Inputs.file({label: "CSV file", accept: ".csv", required: true})
Insert cell
data = file.csv({typed: true})
Insert cell
Inputs.table(data)
Insert cell
plot01 =Plot.plot({
width: 250,
height: 750,
x: {label: "CONE RESISTANCE, qc (MPa)"},
y: {label: "DEPTH, z (m)", reverse: true, domain: [0, 15]},
grid: true,
marks: [
Plot.frame(),
Plot.axisX({anchor: "top", labelAnchor: "center"}),
Plot.axisX({anchor: "bottom", fill: "red", label: null}),
Plot.axisY({anchor: "left", labelAnchor: "center", tickSpacing: 50}),
Plot.line(data, {x: "qc", y: "depth", z: "station_name", opacity: 0.25, strokeWidth: 2.5, tip: true}),
Plot.ruleY([10.87], {strokeDasharray: "1, 2"}),
Plot.text(data, Plot.selectMaxY({x: "qc", y: "depth", text: "depth", frameAnchor: "bottom-left", dy: 10, fill: "currentColor", stroke: "white", strokeWidth: 3}))
]
})
Insert cell
plot02 = Plot.plot({
width: 250,
height: 750,
marginLeft: 0,
x: {label: "SLEEVE FRICTION, fs (MPa)"},
y: {reverse: true, domain: [0, 15], label: null, axis: null},
grid: true,
marks: [
Plot.frame(),
Plot.axisX({anchor: "top", labelAnchor: "center"}),
Plot.axisX({anchor: "bottom", fill: "red", label: null}),
//Plot.axisY({label: null}),
Plot.gridY({tickSpacing: 50}),
Plot.line(data, {x: "fs", y: "depth", z: "station_name", opacity: 0.25, strokeWidth: 2.5}),
Plot.ruleY([10.87], {strokeDasharray: "1, 2"})
]
})
Insert cell
plot03 = Plot.plot({
width: 250,
height: 750,
marginLeft: 5,
marginRight: 5,
x: {label: "PORE PRESSURE, u2 (MPa)"},
y: {reverse: true, domain: [0, 15], label: null, axis: null},
grid: true,
marks: [
Plot.frame(),
Plot.axisX({anchor: "top", labelAnchor: "center"}),
Plot.axisX({anchor: "bottom", fill: "red", label: null}),
//Plot.axisY({label: null}),
Plot.gridY({tickSpacing: 50}),
Plot.line(data, {x: "u2", y: "depth", z: "station_name", opacity: 0.25, strokeWidth: 2.5}),
Plot.ruleY([10.87], {strokeDasharray: "1, 2"})
]
})
Insert cell
plot04 = Plot.plot({
width: 250,
height: 750,
marginLeft: 5,
marginRight: 5,
x: {label: "NORMALISED CONE RESISTANCE, Qtn (MPa)", type: "log", domain: [1e0, 1e3]},
y: {reverse: true, domain: [0, 15], label: null, axis: null},
grid: true,
marks: [
Plot.frame(),
Plot.axisX({anchor: "top", labelAnchor: "center"}),
Plot.axisX({anchor: "bottom", fill: "red", label: null}),
//Plot.axisY({label: null}),
Plot.gridY({tickSpacing: 50}),
Plot.line(data, {x: "Qtn", y: "depth", z: "station_name", opacity: 0.25, strokeWidth: 2.5}),
Plot.ruleY([10.87], {strokeDasharray: "1, 2"})
]
})
Insert cell
plot05 = Plot.plot({
//color: {legend: true, },
width: 125,
height: 750,
marginLeft: 5,
x: {label: "SBT (-)", axis: null},
y: {reverse: true, domain: [0, 15], label: null, axis: null},
grid: true,
marks: [
Plot.frame(),
Plot.axisX({anchor: "top", labelAnchor: "center"}),
Plot.axisX({anchor: "bottom", fill: "red", label: null}),
//Plot.axisY({label: null}),
Plot.gridY({tickSpacing: 50}),
Plot.ruleY([10.87], {strokeDasharray: "1, 2"}),
Plot.ruleY(data, {x: "Ic", y: "depth", stroke: "sbt_zone_short", strokeOpacity: 1})
]
})
Insert cell
Compose plots of ${tex`qc, fs, u2`} u<sub>`20`20</sub>
Insert cell
<div style="display: grid; grid-template-columns: 1fr 1fr 1fr 1fr 0.5fr; column-gap: 0px; row-gap: 0px;">
${plot01}
${plot02}
${plot03}
${plot04}
${plot05}
</div>
Insert cell
import { funplot } from '@mbostock/funplot'
Insert cell
import { Text } from '@observablehq/inputs'
Insert cell
math = require('mathjs@9')
Insert cell
viewof f = {
let f = Text({ submit: true, label: tex`f(x):`, value: 'x^2' });
f.getElementsByTagName('label')[0].style.width = '40px';
return f;
}
Insert cell
plot = {
let f_compiled = math.compile(f);
return funplot(x => f_compiled.evaluate({ x: x }));
}
Insert cell
Insert cell
import { aq, op } from '@uwdata/arquero'
Insert cell
dt = aq.from(data)
Insert cell
dt.view()
Insert cell
dt
.orderby(aq.desc('phase', 'water_depth'))
.select('depth', 'qc', 'fs', 'phase', 'station_name', 'water_depth')
//.select(1, 2) // optional select method
.view(5)
Insert cell
dt
.filter(d => d.qc >= 10 & d.fs >= 0.025)
.view(5)
Insert cell
dt
.select(0, 1, 2, 3, 5, 7)
.derive({
qc_net: d => d.qc * 100 + d.u2 * 100,
fs_net: d => d.fs * 50
})
.view(5)
Insert cell
dt
.select(0, 1, 2, 3, 5, 7)
.groupby('phase', 'scope')
.rollup({
qc_m: d => op.mean(d.qc),
fs_m: d => op.mean(d.fs),
count: d => op.count()
})
.view()
Insert cell
viewof dt2 = dt // viewof needed to create the dt2 object
.groupby('phase')
.count()
.view()
Insert cell
dt
.select(0, 1, 2, 3, 5, 7)
.groupby('phase', 'scope')
.derive({
qc_mea_p: d => op.mean(d.qc),
qc_max_p: d => op.max(d.qc)
})
.view(5)
Insert cell
viewof dt3 = dt.select(0, 1, 2, 3, 4, 5, 6, 7).view(5)
Insert cell
dt3
.join_left(dt2)
.view(5)
Insert cell
Insert cell
Inputs.table(dt2)
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