-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathslides.html
196 lines (143 loc) · 3.76 KB
/
slides.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
<!DOCTYPE html>
<html>
<head>
<title>Title</title>
<meta charset="utf-8">
<link rel="stylesheet" href="theme.css">
<link rel="stylesheet" href="columns.css">
<style>
.gray {color: lightgray;}
</style>
</head>
<body>
<textarea id="source">
class: center, middle
# Title
Author
Institution
Date
---
.left-column-33[
## Foo
]
.right-column-66[
A. a
B. b
C. c
]
---
.left-column-33[
## .gray[Foo]
## Bar
]
.right-column-66[
A. A
B. B
C. C
]
---
## Observablehq embed
<iframe width="100%" height="575" frameborder="0"
src="https://observablehq.com/embed/@molpopgen/fixation-under-directional-selection?cells=viewof+N%2Cdetail_plot%2Cviewof+selection_coefficient"></iframe>
---
# Math
$$y=mx+b$$
Or, inline `\(y = mx+b\)`.
---
# Code
```rust
pub fn less_than(a: i64, b: i64) -> bool {
a < b
}
```
```python
def less_than_or_equal(a: int, b: int) -> bool {
return a <= b
}
```
---
# D3 -- JS code is *outside* the `textarea`
<!-- Add a svg area, empty -->
<svg id="Viz_area" height=400 width=450></svg>
---
# D3 in a column
.left-column[
Stuff on the left that should all fit in and not overlap the figure to the right.
Did it work?
]
.right-column[
<svg id="Viz_area2" height=400 width=400></svg>
]
---
# D3 from a file
<svg id="Viz_area3" width="100%", height=500></svg>
---
# Observable Plot
See [here](https://github.com/observablehq/plot) and
[here](https://www.josephoreilly.com/post/2021-08-04-observable-plot/).
<figure id="fig1"></figure>
</textarea>
<script src="https://remarkjs.com/downloads/remark-latest.min.js">
</script>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS_HTML&delayStartupUntil=configugray"
type="text/javascript"></script>
<script>
var slideshow = remark.create();
// Setup MathJax
MathJax.Hub.Config({
tex2jax: {
skipTags: ['script', 'noscript', 'style', 'textarea', 'pre']
}
});
MathJax.Hub.Configured();
</script>
<!-- The next two lines import D3 and Observable Plot.
Delete 1 or both as needed. -->
<script src="https://cdn.jsdelivr.net/npm/d3@7"></script>
<script src="https://cdn.jsdelivr.net/npm/@observablehq/[email protected]"></script>
<script>
var svg = d3.select("#Viz_area")
// Create a scale: transform value in pixel
var x = d3.scaleLinear()
.domain([0, 100]) // This is the min and the max of the data: 0 to 100 if percentages
.range([0, 400]); // This is the corresponding value I want in Pixel
// Show the axis that corresponds to this scale
svg.call(d3.axisBottom(x));
// Add 3 dots for 0, 50 and 100%
svg.append("circle")
.attr("cx", x(10)).attr("cy", 100).attr("r", 40).style("fill", "blue");
svg.append("circle")
.attr("cx", x(50)).attr("cy", 100).attr("r", 40).style("fill", "red");
svg.append("circle")
.attr("cx", x(100)).attr("cy", 100).attr("r", 40).style("fill", "green");
</script>
<script>
var svg = d3.select("#Viz_area2").append("svg")
// Add the path using this helper function
svg.append('rect')
.attr('x', 10)
.attr('y', 120)
.attr('width', 600)
.attr('height', 40)
.attr('stroke', 'black')
.attr('fill', '#69a3b2');
svg.append('rect')
.attr('x', 10)
.attr('y', 5)
.attr('width', 600)
.attr('height', 40)
.attr('stroke', 'black')
.attr('fill', '#69a3b2');
svg.append('rect')
.attr('x', 10)
.attr('y', 300)
.attr('width', 600)
.attr('height', 40)
.attr('stroke', 'black')
.attr('fill', '#69a3b2');
</script>
<script src="area3.js"></script>
<script src="plot.js"></script>
</body>
</html>