Seven Lines of Julia (examples sought)

I know this is more than seven lines, but like above in the spirit of the thread.
(It’s seven lines if you ignore the setup and cleanup :stuck_out_tongue:)

using Term, REPL, UnicodePlots

begin
    t, N, Fn = REPL.TerminalMenus.terminal, 0, "15sinc(√(x^2 + y^2) / Ο€)"
    REPL.Terminals.raw!(t, true), print(stdout, "\x1b[?25l")
    io = IOContext(PipeBuffer(), :color=>true)
    while true
        println(io, Panel(string(surfaceplot(-8:8., -8:8., eval(Meta.parse("(x, y) ->"*Fn));
            azimuth = mod(N, 360) - 180, zoom = 1.25, colormap = :jet, lines=true);
            color = true); fit = false, padding= (0, 0, 2, 2), title = Fn, width = 90, 
            justify = :center, subtitle = "[j]/[l] to rotate, [q] to quit", subtitle_justify=:right))
        REPL.Terminals.clear(t); println(read(io, String))
        c = read(stdin, Char);
        c == 'q' && break; c == 'j' && (N += 10); c == 'l' && (N -= 10)
    end
    REPL.Terminals.raw!(t, false), print(stdout, "\x1b[?25h")
end

This yields (the picture loses a little, it is interactive!)

Code partially taken from: [ANN] UnicodePlots.jl v2.8.0 - 3D plots

23 Likes