This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[{"snippet_range":[93084,93723],"snippet":"\n“He wants payin’ fer deliverin’ the paper. Look in the \npockets.” \nHagrid ’s coat seemed to be made of nothing but \npockets — bunches of keys, slug pellets, balls of \nstring, peppermint humbugs, teabags ... finally, Harry \npulled out a handful of strange-looking coins. \n“Give him five Knuts,” said Hagrid sleepily. \n“Knuts?” \n“The little bronze ones.” \nHarry counted out five little bronze coins, and the owl \nheld out his leg so Harry could put the money into a \n\nsmall leather pouch tied to it. Then he flew off \nthrough the open window. \nHagrid yawned loudly, sat up, and stretched. \n“Best be off, Harry, lots t","response":"Item,Galleons,Sickles,Knuts\n\"Owl Delivery\",0,0,5"},{"snippet_range":[106718,107323],"snippet":"ht more eyes. He \nturned his head in every direction as they walked up \nthe street, trying to look at everything at once: the \nshops, the things outside them, the people doing their \nshopping. A plump woman outside an Apothecary \nwa |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
s = Scene(camera = campixel!) | |
nodes = Point2f[(100, 100), (200, 300), (100, 400), (500, 400)] | |
for i in 1:length(nodes)-1 | |
for j in i+1:length(nodes) | |
linesegments!(s, nodes[[i, j]]) | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f = Figure() | |
ax = Axis(f[1, 1]) | |
sc = scatter!(randn(10, 2), label = "Points") | |
text!(randn(10, 2), text = ["hey" for _ in 1:10], color = :red) | |
leg = Legend(f[1, 2], [sc, []], ["Points", "Location of heys"]) | |
legscene = leg.blockscene.children[1] | |
leg.grid[1, 1][2, 1] = Label(legscene, "hey", color = :red) | |
notify(leg.margin) # adjust to new legend size without relayout | |
f |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function with_indent_message(f, message) | |
s = mktemp() do path, io | |
redirect_stdout(f, io) | |
flush(io) | |
str = read(path, String) | |
if match(r"^\s*$", str) === nothing | |
replace(str, r"^"m => "│ ") | |
else | |
"" | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Makie.KernelDensity | |
x = randn(1000) | |
k = kde(x, npoints = 200) | |
f = Figure() | |
ax = Axis3(f[1, 1], limits = (-4, 4, -4, 4, 0, 1)) | |
p = poly!(ax, Point2f.(k.x, k.density), | |
model = Makie.Mat4f([ 1 0 0 0 | |
0 0 1 4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f = Figure() | |
ax = Axis(f[1, 1]) | |
ax2 = Axis(f[1, 1], width = Relative(0.3), height = Relative(0.3), valign = 0.8, halign = 0.8) | |
p = Point(1, 1) | |
scatter!(ax, p, markersize = 15) | |
limits!(ax, 0, 10, 0, 10) | |
points = lift(ax.scene.px_area, ax.scene.camera.projectionview, ax2.scene.px_area) do pxa, pv, pxa2 | |
p1 = Makie.bottomright(pxa2) - pxa.origin |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using CairoMakie | |
using Makie.GeometryBasics | |
function mandelbrot(x, y) | |
z = c = x + y*im | |
for i in 1:50.0; abs(z) > 2 && return log(50 - i); z = z^2 + c; end; 0.0 | |
end | |
# r = Rect(-0.74250066, 0.39089617, 0.43069285, 0.34233275) | |
r = HyperRectangle{2, Float32}(Float32[-0.62557947, 0.6001665], Float32[0.056850735, 0.041836016]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using GLMakie | |
data = Observable(randn(30, 30)) | |
lineindex = Observable(1) | |
linedata = @lift $data[:, $lineindex] | |
f, ax, hm = heatmap(data, axis = (; aspect = 1)) | |
selectionrect = @lift Rect2f(0.5, $lineindex-0.5, size($data, 1), 1) | |
wireframe!(selectionrect, color = :white) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
C_1 = C_a * α_a + C_b1 * (1 - α_a) | |
C_2 = C_a * α_a + C_b2 * (1 - α_a) | |
C_1 - C_2 = (C_b1 - C_b2) * (1 - α_a) | |
1 - (C_1 - C_2) / (C_b1 - C_b2) = α_a | |
(C_1 - (C_b1 * (1 - α_a))) / α_a = C_a | |
## |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mutable struct Multiobservable | |
value::NamedTuple | |
listeners::Vector | |
end | |
Multiobservable(nt) = Multiobservable(nt, []) | |
function Makie.Observables.on(f, m::Multiobservable, syms::Symbol...) | |
push!(m.listeners, f) | |
f |