Skip to content

Instantly share code, notes, and snippets.

@j-fu
Created September 11, 2020 17:25
Show Gist options
  • Save j-fu/bb334cea47f97749ac250785aef0df47 to your computer and use it in GitHub Desktop.
Save j-fu/bb334cea47f97749ac250785aef0df47 to your computer and use it in GitHub Desktop.
### A Pluto.jl notebook ###
# v0.11.14
using Markdown
using InteractiveUtils
# This Pluto notebook uses @bind for interactivity. When running this notebook outside of Pluto, the following 'mock version' of @bind gives bound variables a default value (instead of an error).
macro bind(def, element)
quote
local el = $(esc(element))
global $(esc(def)) = Core.applicable(Base.get, el) ? Base.get(el) : missing
el
end
end
# ╔═╡ e7a727a2-f44d-11ea-2886-191041f5e2cc
using WGLMakie, AbstractPlotting
# ╔═╡ dade9356-f451-11ea-115c-d9bdfcc2d1ee
zfunc(k,x,y)=sin.(k*π*x)*cos.(k*π*y)'
# ╔═╡ 6d5234f2-f451-11ea-2aad-a5914e8f9765
begin
X = LinRange(-1, 1, 50)
Y = LinRange(-1, 1, 50)
znode=Node(zfunc(1,X,Y))
end;
# ╔═╡ 9b70f53a-f44e-11ea-13de-bd6a660848d0
begin
scene = Scene(resolution = (300,300))
contour!(scene,X, Y, lift(a->a,znode), levels = 10, linewidth =1)
end
# ╔═╡ f7c10e26-f44f-11ea-2e85-89ea12dc994b
@bind k html"<input type=range min=1 max=5>"
# ╔═╡ 62245094-f451-11ea-1c14-2587259ceeb9
push!(znode,zfunc(k,X,Y));
# ╔═╡ Cell order:
# ╠═e7a727a2-f44d-11ea-2886-191041f5e2cc
# ╠═dade9356-f451-11ea-115c-d9bdfcc2d1ee
# ╠═6d5234f2-f451-11ea-2aad-a5914e8f9765
# ╠═9b70f53a-f44e-11ea-13de-bd6a660848d0
# ╠═62245094-f451-11ea-1c14-2587259ceeb9
# ╠═f7c10e26-f44f-11ea-2e85-89ea12dc994b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment