Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Configuring the browser used to display Gadfly plots in Julia

Tags:

julia

gadfly

I am using Julia 0.4.5 on Windows 7. When I invoke Gadfly.plot, Internet Explorer opens up to display the plot.

How can I configure Julia to use a browser of my choice (like Google Chrome) to display Gadfly plots?

like image 457
buruzaemon Avatar asked Mar 29 '16 08:03

buruzaemon


1 Answers

It seems Gadfly use this function to open .html file:

function open_file(filename)
    if OS_NAME == :Darwin
        run(`open $(filename)`)
    elseif OS_NAME == :Linux || OS_NAME == :FreeBSD
        run(`xdg-open $(filename)`)
    elseif OS_NAME == :Windows
        run(`$(ENV["COMSPEC"]) /c start $(filename)`)
    else
        warn("Showing plots is not supported on OS $(string(OS_NAME))")
    end
end

So for Windows, you can write your alternative cmd.exe(maybe a .bat that checks if the argument is a .html, then launch chrome or pass to the true cmd.exe), and replace ENV["COMSPEC"]

like image 142
张实唯 Avatar answered Oct 15 '22 00:10

张实唯