From 5166d164062c93e0a0bab11829b4143c599e2c8d Mon Sep 17 00:00:00 2001 From: Jonathan Anderson Date: Tue, 18 Apr 2017 10:32:07 -0500 Subject: [PATCH] Update gr.jl inline display to match GR.jl MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I wanted to switch from using GR directly to using Plots, but the inline plots were not working for me. The following change is sufficient to generate inline plots in iterm for me https://github.com/jheinen/GR.jl/blob/0f167b2be921a0014c405f760a1e1bc22b222751/src/GR.jl#L3014 julia> versioninfo() Julia Version 0.6.0-pre.beta.187 Commit 55c97fb* (2017-04-17 23:06 UTC) Platform Info: OS: Linux (x86_64-redhat-linux) CPU: Intel(R) Xeon(R) CPU E5-2670 v3 @ 2.30GHz WORD_SIZE: 64 BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell) LAPACK: libopenblas64_ LIBM: libopenlibm LLVM: libLLVM-3.9.1 (ORCJIT, haswell) julia> using TerminalExtensions julia> using Plots julia> gr(display_type=:inline); julia> z=[sin(sqrt(x^2+y^2)) for x in linspace(-2π,2π,50), y in linspace(-2π,2π,50)]; julia> contour(z) --- src/backends/gr.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backends/gr.jl b/src/backends/gr.jl index 24ddfd42..b8e3b460 100644 --- a/src/backends/gr.jl +++ b/src/backends/gr.jl @@ -1109,7 +1109,7 @@ function _display(plt::Plot{GRBackend}) ENV["GKS_FILEPATH"] = filepath gr_display(plt) GR.emergencyclosegks() - content = string("\033]1337;File=inline=1;preserveAspectRatio=0:", base64encode(open(readbytes, filepath)), "\a") + content = string("\033]1337;File=inline=1;preserveAspectRatio=0:", base64encode(open(read, filepath)), "\a") println(content) rm(filepath) else