Skip to content

Instantly share code, notes, and snippets.

@briochemc
Last active October 19, 2020 07:17
Show Gist options
  • Save briochemc/1ed69f6c770b59963c6bcc73c15a444b to your computer and use it in GitHub Desktop.
Save briochemc/1ed69f6c770b59963c6bcc73c15a444b to your computer and use it in GitHub Desktop.
### A Pluto.jl notebook ###
# v0.12.4
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
# ╔═╡ 641cd78a-11bf-11eb-3df1-cdf4f998cfa5
using ColorSchemes, Plots, PlutoUI, Random
# ╔═╡ 53c57b20-11d6-11eb-169d-2bb70c40d032
@bind go Button("New random colors")
# ╔═╡ 446e280a-11d6-11eb-3f8f-79ed77550e0f
begin
go
scheme = first(Random.shuffle!(collect(keys(colorschemes))))
mypalette = palette(scheme, 10)
end
# ╔═╡ 291a891c-11d2-11eb-18b5-3f62c7a694ac
begin
rgbs(i,j,n) = RGB.(cgrad([mypalette[i], mypalette[j]], n).colors.colors)
mini_img(i,j,n) = repeat(rgbs(i,j,n)',n,1)
my_table(n=30) = hvcat(10, [mini_img(i,j,n) for i in 1:10 for j in 1:10]...)
end
# ╔═╡ 8e808df4-11c0-11eb-3a6f-0b802b180dec
begin
n = 30
x = y = range(-0.5, 9.5, length=10n)
plt = plot(x, y, my_table(n), xmirror=true, xticks=0:9, yticks=0:9, xlab="ones", ylab="tens")
[annotate!(plt, x, y, string(10y + x)) for x in 0:9, y in 0:9]
plt
end
# ╔═╡ Cell order:
# ╟─641cd78a-11bf-11eb-3df1-cdf4f998cfa5
# ╟─53c57b20-11d6-11eb-169d-2bb70c40d032
# ╟─446e280a-11d6-11eb-3f8f-79ed77550e0f
# ╟─8e808df4-11c0-11eb-3a6f-0b802b180dec
# ╟─291a891c-11d2-11eb-18b5-3f62c7a694ac
@briochemc
Copy link
Author

colortable_challenge_v2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment