6

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?

buruzaemon
  • 3,847
  • 1
  • 23
  • 44

2 Answers2

6

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"]

张实唯
  • 2,836
  • 13
  • 25
  • Thanks for the clarification, @张实唯. I take this to mean that, at present, there is no way to configure Julia to use a browser of my choice. However, I could easily hack Gadfly.jl to do. Maybe I should make a pull request. :-) – buruzaemon Mar 30 '16 at 06:12
0

try: Set Google chrome as default browser for your all .html or .htm files.

python必须死
  • 999
  • 10
  • 12
  • 1
    Julia seems pretty configurable. I am looking for a solution in Julia, not one that makes a direct change to which Windows application opens what file extension. – buruzaemon Mar 29 '16 at 23:09