1
0
Fork 0
mirror of https://gitlab.rlp.net/mobitar/julia_course.git synced 2024-11-16 13:28:10 +00:00

Add Luxor demo

This commit is contained in:
Mo8it 2022-04-01 04:58:32 +02:00
parent 1cca8d0d27
commit 9aaa2676df

View file

@ -4,6 +4,16 @@
using Markdown using Markdown
using InteractiveUtils 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 iv = try Base.loaded_modules[Base.PkgId(Base.UUID("6e696c72-6542-2067-7265-42206c756150"), "AbstractPlutoDingetjes")].Bonds.initial_value catch; b -> missing; end
local el = $(esc(element))
global $(esc(def)) = Core.applicable(Base.get, el) ? Base.get(el) : iv(el)
el
end
end
# ╔═╡ 20cc1d6e-90a8-4e60-8c0b-badf605337eb # ╔═╡ 20cc1d6e-90a8-4e60-8c0b-badf605337eb
using PhysicalConstants.CODATA2018 using PhysicalConstants.CODATA2018
@ -78,6 +88,9 @@ begin
""" """
end end
# ╔═╡ 8b5cd80f-03bb-4d3b-a6ab-d53da2fa0cff
using Luxor
# ╔═╡ c7e76680-571e-427d-a564-8819df8b3750 # ╔═╡ c7e76680-571e-427d-a564-8819df8b3750
# Oh, no, you found my secret! 😱 # Oh, no, you found my secret! 😱
# Don't change this hidden cell! # Don't change this hidden cell!
@ -471,8 +484,26 @@ JLD2.load_object("resources/jld2_demo.jld2")
# ╔═╡ 7e75da58-f110-41cb-ab19-79376370965f # ╔═╡ 7e75da58-f110-41cb-ab19-79376370965f
md""" md"""
## `Luxor.jl` ## `Luxor.jl`
For generating vector graphics.
""" """
# ╔═╡ 17f037d3-0dd1-4c3e-bd54-9fa03b7b3365
@bind steps PlutoUI.Slider(1:24, default=3, show_value=true)
# ╔═╡ 1be2d61a-5a6f-40c6-86aa-a8b515addabb
@draw begin
gap = 2
for (n, θ) in enumerate(range(0, step=2π/steps, length=steps))
sethue([
Luxor.julia_green,
Luxor.julia_red,
Luxor.julia_purple,
Luxor.julia_blue
][mod1(n, 4)])
sector(Luxor.Point(0, 0), 50, 250 + 2n, θ, θ + 2π/steps - deg2rad(gap), :fill)
end
end
# ╔═╡ 6b417e5d-01c2-4b06-9708-62c422a6b64b # ╔═╡ 6b417e5d-01c2-4b06-9708-62c422a6b64b
md""" md"""
## `DifferentialEquations.jl` ## `DifferentialEquations.jl`
@ -513,6 +544,7 @@ PLUTO_PROJECT_TOML_CONTENTS = """
CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0" CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
GLMakie = "e9467ef8-e4e7-5192-8a1a-b1aee30e663a" GLMakie = "e9467ef8-e4e7-5192-8a1a-b1aee30e663a"
JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819" JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819"
Luxor = "ae8d54c2-7ccd-5906-9d76-62fc9837b5bc"
Measurements = "eff96d63-e80a-5855-80a2-b1b0885c5ab7" Measurements = "eff96d63-e80a-5855-80a2-b1b0885c5ab7"
PeriodicTable = "7b2266bf-644c-5ea3-82d8-af4bbd25a884" PeriodicTable = "7b2266bf-644c-5ea3-82d8-af4bbd25a884"
PhysicalConstants = "5ad8b20f-a522-5ce9-bfc9-ddf1d5bda6ab" PhysicalConstants = "5ad8b20f-a522-5ce9-bfc9-ddf1d5bda6ab"
@ -525,6 +557,7 @@ Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
CairoMakie = "~0.7.5" CairoMakie = "~0.7.5"
GLMakie = "~0.5.5" GLMakie = "~0.5.5"
JLD2 = "~0.4.22" JLD2 = "~0.4.22"
Luxor = "~3.1.1"
Measurements = "~2.7.1" Measurements = "~2.7.1"
PeriodicTable = "~1.1.1" PeriodicTable = "~1.1.1"
PhysicalConstants = "~0.2.1" PhysicalConstants = "~0.2.1"
@ -1062,6 +1095,12 @@ git-tree-sha1 = "b53380851c6e6664204efb2e62cd24fa5c47e4ba"
uuid = "aacddb02-875f-59d6-b918-886e6ef4fbf8" uuid = "aacddb02-875f-59d6-b918-886e6ef4fbf8"
version = "2.1.2+0" version = "2.1.2+0"
[[deps.Juno]]
deps = ["Base64", "Logging", "Media", "Profile"]
git-tree-sha1 = "07cb43290a840908a771552911a6274bc6c072c7"
uuid = "e5e0dc1b-0480-54bc-9374-aad01c23163d"
version = "0.8.4"
[[deps.KernelDensity]] [[deps.KernelDensity]]
deps = ["Distributions", "DocStringExtensions", "FFTW", "Interpolations", "StatsBase"] deps = ["Distributions", "DocStringExtensions", "FFTW", "Interpolations", "StatsBase"]
git-tree-sha1 = "591e8dc09ad18386189610acafb970032c519707" git-tree-sha1 = "591e8dc09ad18386189610acafb970032c519707"
@ -1074,6 +1113,12 @@ git-tree-sha1 = "f6250b16881adf048549549fba48b1161acdac8c"
uuid = "c1c5ebd0-6772-5130-a774-d5fcae4a789d" uuid = "c1c5ebd0-6772-5130-a774-d5fcae4a789d"
version = "3.100.1+0" version = "3.100.1+0"
[[deps.LERC_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "bf36f528eec6634efc60d7ec062008f171071434"
uuid = "88015f11-f218-50d7-93a8-a6af411a945d"
version = "3.0.0+1"
[[deps.LZO_jll]] [[deps.LZO_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "e5b909bcf985c5e2605737d2ce278ed791b89be6" git-tree-sha1 = "e5b909bcf985c5e2605737d2ce278ed791b89be6"
@ -1144,6 +1189,18 @@ git-tree-sha1 = "9c30530bf0effd46e15e0fdcf2b8636e78cbbd73"
uuid = "4b2f31a3-9ecc-558c-b454-b3730dcb73e9" uuid = "4b2f31a3-9ecc-558c-b454-b3730dcb73e9"
version = "2.35.0+0" version = "2.35.0+0"
[[deps.Librsvg_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pango_jll", "Pkg", "gdk_pixbuf_jll"]
git-tree-sha1 = "25d5e6b4eb3558613ace1c67d6a871420bfca527"
uuid = "925c91fb-5dd6-59dd-8e8c-345e74382d89"
version = "2.52.4+0"
[[deps.Libtiff_jll]]
deps = ["Artifacts", "JLLWrappers", "JpegTurbo_jll", "LERC_jll", "Libdl", "Pkg", "Zlib_jll", "Zstd_jll"]
git-tree-sha1 = "c9551dd26e31ab17b86cbd00c2ede019c08758eb"
uuid = "89763e89-9b03-5906-acba-b20f662cd828"
version = "4.3.0+1"
[[deps.Libuuid_jll]] [[deps.Libuuid_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "7f3efec06033682db852f8b3bc3c1d2b0a0ab066" git-tree-sha1 = "7f3efec06033682db852f8b3bc3c1d2b0a0ab066"
@ -1163,6 +1220,12 @@ version = "0.3.10"
[[deps.Logging]] [[deps.Logging]]
uuid = "56ddb016-857b-54e1-b83d-db4d58db5568" uuid = "56ddb016-857b-54e1-b83d-db4d58db5568"
[[deps.Luxor]]
deps = ["Base64", "Cairo", "Colors", "Dates", "FFMPEG", "FileIO", "Juno", "LaTeXStrings", "Random", "Requires", "Rsvg"]
git-tree-sha1 = "6724fd68b3f1d022d3890e4e0e200fbaa1afc03f"
uuid = "ae8d54c2-7ccd-5906-9d76-62fc9837b5bc"
version = "3.1.1"
[[deps.MKL_jll]] [[deps.MKL_jll]]
deps = ["Artifacts", "IntelOpenMP_jll", "JLLWrappers", "LazyArtifacts", "Libdl", "Pkg"] deps = ["Artifacts", "IntelOpenMP_jll", "JLLWrappers", "LazyArtifacts", "Libdl", "Pkg"]
git-tree-sha1 = "e595b205efd49508358f7dc670a940c790204629" git-tree-sha1 = "e595b205efd49508358f7dc670a940c790204629"
@ -1217,6 +1280,12 @@ git-tree-sha1 = "88cd033eb781c698e75ae0b680e5cef1553f0856"
uuid = "eff96d63-e80a-5855-80a2-b1b0885c5ab7" uuid = "eff96d63-e80a-5855-80a2-b1b0885c5ab7"
version = "2.7.1" version = "2.7.1"
[[deps.Media]]
deps = ["MacroTools", "Test"]
git-tree-sha1 = "75a54abd10709c01f1b86b84ec225d26e840ed58"
uuid = "e89f7d12-3494-54d1-8411-f7d8b9ae1f27"
version = "0.5.0"
[[deps.MeshIO]] [[deps.MeshIO]]
deps = ["ColorTypes", "FileIO", "GeometryBasics", "Printf"] deps = ["ColorTypes", "FileIO", "GeometryBasics", "Printf"]
git-tree-sha1 = "8be09d84a2d597c7c0c34d7d604c039c9763e48c" git-tree-sha1 = "8be09d84a2d597c7c0c34d7d604c039c9763e48c"
@ -1424,6 +1493,10 @@ version = "1.3.1"
deps = ["Unicode"] deps = ["Unicode"]
uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7" uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7"
[[deps.Profile]]
deps = ["Printf"]
uuid = "9abbd945-dff8-562f-b5e8-e1ebf5ef1b79"
[[deps.ProgressMeter]] [[deps.ProgressMeter]]
deps = ["Distributed", "Printf"] deps = ["Distributed", "Printf"]
git-tree-sha1 = "d7a7aef8f8f2d537104f170139553b14dfe39fe9" git-tree-sha1 = "d7a7aef8f8f2d537104f170139553b14dfe39fe9"
@ -1496,6 +1569,12 @@ git-tree-sha1 = "6085b8ac184add45b586ed8d74468310948dcfe8"
uuid = "f2b01f46-fcfa-551c-844a-d8ac1e96c665" uuid = "f2b01f46-fcfa-551c-844a-d8ac1e96c665"
version = "1.4.0" version = "1.4.0"
[[deps.Rsvg]]
deps = ["Cairo", "Glib_jll", "Librsvg_jll"]
git-tree-sha1 = "3d3dc66eb46568fb3a5259034bfc752a0eb0c686"
uuid = "c4c386cf-5103-5370-be45-f3a111cca3b8"
version = "1.0.0"
[[deps.SHA]] [[deps.SHA]]
uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce" uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce"
@ -1783,6 +1862,18 @@ version = "1.4.0+3"
deps = ["Libdl"] deps = ["Libdl"]
uuid = "83775a58-1f1d-513f-b197-d71354ab007a" uuid = "83775a58-1f1d-513f-b197-d71354ab007a"
[[deps.Zstd_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "e45044cd873ded54b6a5bac0eb5c971392cf1927"
uuid = "3161d3a3-bdf6-5164-811a-617609db77b4"
version = "1.5.2+0"
[[deps.gdk_pixbuf_jll]]
deps = ["Artifacts", "Glib_jll", "JLLWrappers", "JpegTurbo_jll", "Libdl", "Libtiff_jll", "Pkg", "Xorg_libX11_jll", "libpng_jll"]
git-tree-sha1 = "c23323cd30d60941f8c68419a70905d9bdd92808"
uuid = "da03df04-f53b-5353-a52f-6a8b0620ced0"
version = "2.42.6+1"
[[deps.isoband_jll]] [[deps.isoband_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "51b5eeb3f98367157a7a12a1fb0aa5328946c03c" git-tree-sha1 = "51b5eeb3f98367157a7a12a1fb0aa5328946c03c"
@ -1922,7 +2013,10 @@ version = "3.5.0+0"
# ╠═62fcfe2a-2a33-4ace-b9df-9ae295446df2 # ╠═62fcfe2a-2a33-4ace-b9df-9ae295446df2
# ╠═4d44453e-31b3-4209-a9a7-5c8502c5cada # ╠═4d44453e-31b3-4209-a9a7-5c8502c5cada
# ╠═9bbef800-6926-4c47-8fd0-dece3640bc04 # ╠═9bbef800-6926-4c47-8fd0-dece3640bc04
# ╠═7e75da58-f110-41cb-ab19-79376370965f # ╟─7e75da58-f110-41cb-ab19-79376370965f
# ╠═8b5cd80f-03bb-4d3b-a6ab-d53da2fa0cff
# ╠═17f037d3-0dd1-4c3e-bd54-9fa03b7b3365
# ╠═1be2d61a-5a6f-40c6-86aa-a8b515addabb
# ╠═6b417e5d-01c2-4b06-9708-62c422a6b64b # ╠═6b417e5d-01c2-4b06-9708-62c422a6b64b
# ╟─0174178f-3ed9-4890-8482-714cb51a635d # ╟─0174178f-3ed9-4890-8482-714cb51a635d
# ╠═d29338b3-3c25-4ae4-90d0-1176538c635e # ╠═d29338b3-3c25-4ae4-90d0-1176538c635e