Skip to content

Instantly share code, notes, and snippets.

@j-fu
Created January 12, 2021 17:45
Show Gist options
  • Save j-fu/efe75cc057d4d8643464b196bbce0eb7 to your computer and use it in GitHub Desktop.
Save j-fu/efe75cc057d4d8643464b196bbce0eb7 to your computer and use it in GitHub Desktop.
twglmakie #2
### A Pluto.jl notebook ###
# v0.12.18
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
# ╔═╡ 09d65712-4bba-11eb-3f63-cfeb0925bb64
begin
using Pkg
Pkg.activate(mktempdir())
Pkg.add(["AbstractPlotting","WGLMakie","JSServe","PlutoUI"])
using PlutoUI
using AbstractPlotting, WGLMakie,JSServe
end
# ╔═╡ 82d50a2c-54ee-11eb-0938-5f2c42f4eaae
with_terminal() do
Pkg.status()
end
# ╔═╡ 85a1174c-54f7-11eb-13b5-194707007a2d
begin
port = 8449 # the port you want
JSServe.JSSERVE_CONFIGURATION.listen_port[] = port
JSServe.JSSERVE_CONFIGURATION.external_url[] = "http://localhost:$(port)"
JSServe.JSSERVE_CONFIGURATION.content_delivery_url[] = "http://localhost:$(port)"
JSServe.Page() # needs to get displayed by Pluto
end
# ╔═╡ 9acad142-54f9-11eb-3d8b-a332e64ad09d
@bind n PlutoUI.Slider(3:100)
# ╔═╡ 4802c066-54fc-11eb-3bdb-4974cb17239f
d2d=Node(rand(5,2));
# ╔═╡ bd26ee26-54fc-11eb-396f-7b3fc49d2785
d3d=Node(rand(5,3));
# ╔═╡ 45fe7d4e-54f9-11eb-068d-4939b7033a64
let
parent,layout=layoutscene()
ax1=layout[1,1]=LScene(parent)
scatter!(ax1,lift(a->a,d2d))
ax2=layout[1,2]=Axis(parent)
scatter!(ax2,lift(a->a,d3d))
parent
end
# ╔═╡ 5f5cd8f6-54f9-11eb-01a6-cb1b4edd3694
d2d[]=rand(n,2);
# ╔═╡ fbe11716-54fc-11eb-2c0c-0f3f625203d0
d3d[]=rand(n,3);
# ╔═╡ Cell order:
# ╠═09d65712-4bba-11eb-3f63-cfeb0925bb64
# ╠═82d50a2c-54ee-11eb-0938-5f2c42f4eaae
# ╠═85a1174c-54f7-11eb-13b5-194707007a2d
# ╠═9acad142-54f9-11eb-3d8b-a332e64ad09d
# ╠═4802c066-54fc-11eb-3bdb-4974cb17239f
# ╠═bd26ee26-54fc-11eb-396f-7b3fc49d2785
# ╠═45fe7d4e-54f9-11eb-068d-4939b7033a64
# ╠═5f5cd8f6-54f9-11eb-01a6-cb1b4edd3694
# ╠═fbe11716-54fc-11eb-2c0c-0f3f625203d0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment