GiovineItalia / Gadfly.jl

Crafty statistical graphics for Julia.
http://gadflyjl.org/stable/
Other
1.9k stars 251 forks source link

display() #1230

Closed montyvesselinov closed 5 years ago

montyvesselinov commented 5 years ago

old versions of Gadfly for julia 0.6,4 were producing plots that can be plotted by TerminalExtensions.jl in the REPL. The new versions for 0.7 & 1.0 cannot do this.

Function as this is needed:

function display(p::Gadfly.Plot)
Gadfly.draw(Gadfly.PNG(), p)
println()
end

can you add something like this in the code?

bjarthur commented 5 years ago

it still plots in the browser for me when using iTerm2:

julia> using TerminalExtensions

julia> using Gadfly

julia> function display(p::Gadfly.Plot)
       Gadfly.draw(Gadfly.PNG(), p)
       println()
       end
display (generic function with 1 method)

julia> plot(y=[1,2,3])
montyvesselinov commented 5 years ago

To extend Base.display, Base.display should be imported first.

    import Gadfly
    import Cairo, Fontconfig
    import Base: display
    function Base.display(p::Gadfly.Plot)
        Gadfly.draw(Gadfly.PNG(), p)
        print("\r")
    end