-
-
Save briochemc/60561a74f4fde32dd5d45fbf8a2324cd to your computer and use it in GitHub Desktop.
This file contains 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 Luxor, Colors | |
function main(fname) | |
Drawing(600, 600, fname) | |
origin() | |
circle(O, 290, :clip) | |
sethue("white") | |
paint() | |
colors = [Luxor.julia_blue, Luxor.julia_red, Luxor.julia_green, Luxor.julia_purple] | |
# make a table with rows smaller in the middle | |
progression = [70, 55, 47, 40, 30, 20, 14] | |
fatrows = vcat(progression, reverse(progression)) | |
# every other row is blank | |
thinrows = fill(12, 2 * length(progression)) | |
table = Table(collect(Iterators.flatten(zip(fatrows, thinrows))), [500]) | |
L = length(table) | |
wavelength = 70 | |
for (pos, n) in table | |
table.rowheights[n] < minimum(progression) && continue # skip thin rows | |
# march through the four Julia colors | |
col = convert(Int, min(1 + floor((n - 1) / L * 4), 4)) | |
sethue(colors[col]) | |
@layer begin | |
translate(pos) | |
# amplitude of sine scales by y coordinate | |
sf = rescale(abs(pos.y), 0, 300, 5, 32) | |
pts = [Point(x, sf * sin(x * 1/wavelength)) for x = -300:300] | |
setline(table.rowheights[n]) | |
poly(pts, :stroke) | |
end | |
end | |
# outer ring | |
@layer begin | |
setcolor("#635") | |
setline(30) | |
circle(O, 291, :stroke) | |
end | |
finish() | |
preview() | |
end | |
main("/tmp/juliaclimate.png") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment