-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathgaussian_cutoff.html
41 lines (38 loc) · 10.9 KB
/
gaussian_cutoff.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<!DOCTYPE html>
<html>
<head>
<style>
#vis.vega-embed {
width: 100%;
display: flex;
}
#vis.vega-embed details,
#vis.vega-embed details summary {
position: relative;
}
</style>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/vega@5"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/vega-lite@5.8.0"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/vega-embed@6"></script>
</head>
<body>
<div id="vis"></div>
<script>
(function(vegaEmbed) {
var spec = {"config": {"view": {"continuousWidth": 300, "continuousHeight": 300}}, "hconcat": [{"layer": [{"mark": {"type": "area", "clip": true, "color": "#C84E0099"}, "encoding": {"x": {"field": "x", "scale": {"domain": [-5, 10]}, "title": "", "type": "quantitative"}, "y": {"field": "ycalc", "title": "", "type": "quantitative"}}, "transform": [{"calculate": "((1.0 / (sqrt((2 * PI)) * param_48)) * exp((-0.5 * (pow((datum.x - param_47),2) / pow(param_48,2)))))", "as": "ycalc"}, {"filter": "(datum.x >= param_49)"}]}, {"mark": {"type": "line", "clip": true, "color": "#262626"}, "encoding": {"x": {"field": "x", "scale": {"domain": [-5, 10]}, "title": "", "type": "quantitative"}, "y": {"field": "ycalc", "title": "", "type": "quantitative"}}, "transform": [{"calculate": "((1.0 / (sqrt((2 * PI)) * param_48)) * exp((-0.5 * (pow((datum.x - param_47),2) / pow(param_48,2)))))", "as": "ycalc"}]}], "height": 150}, {"mark": {"type": "bar", "color": "#C84E00CC", "size": 50}, "encoding": {"y": {"aggregate": "sum", "axis": {"title": "Area of orange region"}, "field": "ycalc", "scale": {"domain": [0, 10]}, "type": "quantitative"}}, "height": 150, "transform": [{"calculate": "((1.0 / (sqrt((2 * PI)) * param_48)) * exp((-0.5 * (pow((datum.x - param_47),2) / pow(param_48,2)))))", "as": "ycalc"}, {"filter": "(datum.x >= param_49)"}], "width": 100}], "data": {"name": "data-51ae1ed5cb2212e7b4639c38a9c226e2"}, "params": [{"name": "param_49", "bind": {"input": "range", "max": 10, "min": -5, "name": "cutoff:", "step": 0.1}, "value": 0}, {"name": "param_48", "bind": {"input": "range", "max": 10, "min": 0.1, "name": "width:", "step": 0.1}, "value": 1}, {"name": "param_47", "bind": {"input": "range", "max": 10, "min": -5, "name": "center:", "step": 0.1}, "value": 0}], "$schema": "https://vega.github.io/schema/vega-lite/v5.8.0.json", "datasets": {"data-51ae1ed5cb2212e7b4639c38a9c226e2": [{"x": -10.0}, {"x": -9.9}, {"x": -9.8}, {"x": -9.700000000000001}, {"x": -9.600000000000001}, {"x": -9.500000000000002}, {"x": -9.400000000000002}, {"x": -9.300000000000002}, {"x": -9.200000000000003}, {"x": -9.100000000000003}, {"x": -9.000000000000004}, {"x": -8.900000000000004}, {"x": -8.800000000000004}, {"x": -8.700000000000005}, {"x": -8.600000000000005}, {"x": -8.500000000000005}, {"x": -8.400000000000006}, {"x": -8.300000000000006}, {"x": -8.200000000000006}, {"x": -8.100000000000007}, {"x": -8.000000000000007}, {"x": -7.9000000000000075}, {"x": -7.800000000000008}, {"x": -7.700000000000008}, {"x": -7.6000000000000085}, {"x": -7.500000000000009}, {"x": -7.400000000000009}, {"x": -7.30000000000001}, {"x": -7.20000000000001}, {"x": -7.10000000000001}, {"x": -7.000000000000011}, {"x": -6.900000000000011}, {"x": -6.800000000000011}, {"x": -6.700000000000012}, {"x": -6.600000000000012}, {"x": -6.500000000000012}, {"x": -6.400000000000013}, {"x": -6.300000000000013}, {"x": -6.2000000000000135}, {"x": -6.100000000000014}, {"x": -6.000000000000014}, {"x": -5.900000000000015}, {"x": -5.800000000000015}, {"x": -5.700000000000015}, {"x": -5.600000000000016}, {"x": -5.500000000000016}, {"x": -5.400000000000016}, {"x": -5.300000000000017}, {"x": -5.200000000000017}, {"x": -5.100000000000017}, {"x": -5.000000000000018}, {"x": -4.900000000000018}, {"x": -4.8000000000000185}, {"x": -4.700000000000019}, {"x": -4.600000000000019}, {"x": -4.5000000000000195}, {"x": -4.40000000000002}, {"x": -4.30000000000002}, {"x": -4.200000000000021}, {"x": -4.100000000000021}, {"x": -4.000000000000021}, {"x": -3.9000000000000217}, {"x": -3.800000000000022}, {"x": -3.7000000000000224}, {"x": -3.6000000000000227}, {"x": -3.500000000000023}, {"x": -3.4000000000000234}, {"x": -3.300000000000024}, {"x": -3.200000000000024}, {"x": -3.1000000000000245}, {"x": -3.000000000000025}, {"x": -2.9000000000000252}, {"x": -2.8000000000000256}, {"x": -2.700000000000026}, {"x": -2.6000000000000263}, {"x": -2.5000000000000266}, {"x": -2.400000000000027}, {"x": -2.3000000000000274}, {"x": -2.2000000000000277}, {"x": -2.100000000000028}, {"x": -2.0000000000000284}, {"x": -1.9000000000000288}, {"x": -1.8000000000000291}, {"x": -1.7000000000000295}, {"x": -1.6000000000000298}, {"x": -1.5000000000000302}, {"x": -1.4000000000000306}, {"x": -1.300000000000031}, {"x": -1.2000000000000313}, {"x": -1.1000000000000316}, {"x": -1.000000000000032}, {"x": -0.9000000000000323}, {"x": -0.8000000000000327}, {"x": -0.700000000000033}, {"x": -0.6000000000000334}, {"x": -0.5000000000000338}, {"x": -0.4000000000000341}, {"x": -0.30000000000003446}, {"x": -0.20000000000003482}, {"x": -0.10000000000003517}, {"x": -3.552713678800501e-14}, {"x": 0.09999999999996412}, {"x": 0.19999999999996376}, {"x": 0.2999999999999634}, {"x": 0.39999999999996305}, {"x": 0.4999999999999627}, {"x": 0.5999999999999623}, {"x": 0.699999999999962}, {"x": 0.7999999999999616}, {"x": 0.8999999999999613}, {"x": 0.9999999999999609}, {"x": 1.0999999999999606}, {"x": 1.1999999999999602}, {"x": 1.2999999999999599}, {"x": 1.3999999999999595}, {"x": 1.4999999999999591}, {"x": 1.5999999999999588}, {"x": 1.6999999999999584}, {"x": 1.799999999999958}, {"x": 1.8999999999999577}, {"x": 1.9999999999999574}, {"x": 2.099999999999957}, {"x": 2.1999999999999567}, {"x": 2.2999999999999563}, {"x": 2.399999999999956}, {"x": 2.4999999999999556}, {"x": 2.5999999999999552}, {"x": 2.699999999999955}, {"x": 2.7999999999999545}, {"x": 2.899999999999954}, {"x": 2.999999999999954}, {"x": 3.0999999999999535}, {"x": 3.199999999999953}, {"x": 3.2999999999999527}, {"x": 3.3999999999999524}, {"x": 3.499999999999952}, {"x": 3.5999999999999517}, {"x": 3.6999999999999513}, {"x": 3.799999999999951}, {"x": 3.8999999999999506}, {"x": 3.9999999999999503}, {"x": 4.09999999999995}, {"x": 4.1999999999999496}, {"x": 4.299999999999949}, {"x": 4.399999999999949}, {"x": 4.4999999999999485}, {"x": 4.599999999999948}, {"x": 4.699999999999948}, {"x": 4.799999999999947}, {"x": 4.899999999999947}, {"x": 4.999999999999947}, {"x": 5.099999999999946}, {"x": 5.199999999999946}, {"x": 5.299999999999946}, {"x": 5.399999999999945}, {"x": 5.499999999999945}, {"x": 5.599999999999945}, {"x": 5.699999999999944}, {"x": 5.799999999999944}, {"x": 5.8999999999999435}, {"x": 5.999999999999943}, {"x": 6.099999999999945}, {"x": 6.1999999999999424}, {"x": 6.29999999999994}, {"x": 6.399999999999942}, {"x": 6.499999999999943}, {"x": 6.599999999999941}, {"x": 6.699999999999939}, {"x": 6.79999999999994}, {"x": 6.899999999999942}, {"x": 6.99999999999994}, {"x": 7.0999999999999375}, {"x": 7.199999999999939}, {"x": 7.29999999999994}, {"x": 7.399999999999938}, {"x": 7.499999999999936}, {"x": 7.5999999999999375}, {"x": 7.699999999999939}, {"x": 7.799999999999937}, {"x": 7.899999999999935}, {"x": 7.999999999999936}, {"x": 8.099999999999937}, {"x": 8.199999999999935}, {"x": 8.299999999999933}, {"x": 8.399999999999935}, {"x": 8.499999999999936}, {"x": 8.599999999999934}, {"x": 8.699999999999932}, {"x": 8.799999999999933}, {"x": 8.899999999999935}, {"x": 8.999999999999932}, {"x": 9.09999999999993}, {"x": 9.199999999999932}, {"x": 9.299999999999933}, {"x": 9.399999999999931}, {"x": 9.499999999999929}, {"x": 9.59999999999993}, {"x": 9.699999999999932}, {"x": 9.79999999999993}, {"x": 9.899999999999928}, {"x": 9.999999999999929}, {"x": 10.09999999999993}, {"x": 10.199999999999928}, {"x": 10.299999999999926}, {"x": 10.399999999999928}, {"x": 10.499999999999929}, {"x": 10.599999999999927}, {"x": 10.699999999999925}, {"x": 10.799999999999926}, {"x": 10.899999999999928}, {"x": 10.999999999999925}, {"x": 11.099999999999923}, {"x": 11.199999999999925}, {"x": 11.299999999999926}, {"x": 11.399999999999924}, {"x": 11.499999999999922}, {"x": 11.599999999999923}, {"x": 11.699999999999925}, {"x": 11.799999999999923}, {"x": 11.89999999999992}, {"x": 11.999999999999922}, {"x": 12.099999999999923}, {"x": 12.199999999999921}, {"x": 12.299999999999919}, {"x": 12.39999999999992}, {"x": 12.499999999999922}, {"x": 12.59999999999992}, {"x": 12.699999999999918}, {"x": 12.799999999999919}, {"x": 12.89999999999992}, {"x": 12.999999999999918}, {"x": 13.099999999999916}, {"x": 13.199999999999918}, {"x": 13.299999999999919}, {"x": 13.399999999999917}, {"x": 13.499999999999915}, {"x": 13.599999999999916}, {"x": 13.699999999999918}, {"x": 13.799999999999915}, {"x": 13.899999999999913}, {"x": 13.999999999999915}, {"x": 14.099999999999916}, {"x": 14.199999999999914}, {"x": 14.299999999999912}, {"x": 14.399999999999913}, {"x": 14.499999999999915}, {"x": 14.599999999999913}, {"x": 14.69999999999991}, {"x": 14.799999999999912}, {"x": 14.899999999999913}, {"x": 14.999999999999911}, {"x": 15.099999999999909}, {"x": 15.19999999999991}, {"x": 15.299999999999912}, {"x": 15.39999999999991}, {"x": 15.499999999999908}, {"x": 15.599999999999909}, {"x": 15.69999999999991}, {"x": 15.799999999999908}, {"x": 15.899999999999906}, {"x": 15.999999999999908}, {"x": 16.09999999999991}, {"x": 16.199999999999907}, {"x": 16.299999999999905}, {"x": 16.399999999999906}, {"x": 16.499999999999908}, {"x": 16.599999999999905}, {"x": 16.699999999999903}, {"x": 16.799999999999905}, {"x": 16.899999999999906}, {"x": 16.999999999999904}, {"x": 17.099999999999902}, {"x": 17.199999999999903}, {"x": 17.299999999999905}, {"x": 17.399999999999903}, {"x": 17.4999999999999}, {"x": 17.599999999999902}, {"x": 17.699999999999903}, {"x": 17.7999999999999}, {"x": 17.8999999999999}, {"x": 17.9999999999999}, {"x": 18.099999999999902}, {"x": 18.1999999999999}, {"x": 18.299999999999898}, {"x": 18.3999999999999}, {"x": 18.4999999999999}, {"x": 18.5999999999999}, {"x": 18.699999999999896}, {"x": 18.799999999999898}, {"x": 18.8999999999999}, {"x": 18.999999999999897}, {"x": 19.099999999999895}, {"x": 19.199999999999896}, {"x": 19.299999999999898}, {"x": 19.399999999999896}, {"x": 19.499999999999893}, {"x": 19.599999999999895}, {"x": 19.699999999999896}, {"x": 19.799999999999894}, {"x": 19.899999999999892}, {"x": 19.999999999999893}]}};
var embedOpt = {"mode": "vega-lite"};
function showError(el, error){
el.innerHTML = ('<div style="color:red;">'
+ '<p>JavaScript Error: ' + error.message + '</p>'
+ "<p>This usually means there's a typo in your chart specification. "
+ "See the javascript console for the full traceback.</p>"
+ '</div>');
throw error;
}
const el = document.getElementById('vis');
vegaEmbed("#vis", spec, embedOpt)
.catch(error => showError(el, error));
})(vegaEmbed);
</script>
</body>
</html>