struct PNG{T} s::T end function Base.show(io::IO, ::MIME"image/png", png::PNG) write(io, png.s) end gstdin, gstdout, gstderr = Pipe(), Pipe(), Pipe() gproc = run(pipeline(`gnuplot`, stdin=gstdin, stdout=gstdout, stderr=gstderr), wait=false) filename = tempname() * ".png" command = """ set terminal pngcairo enhanced set output '$(filename)' plot sin(x), cos(x) """ @show write(gstdin, command) flush(gstdin) sleep(0.1) read(filename) |> PNG