You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to update Gaston for use in IJulia after the writemime() deprecation in Julia 0.5
In Julia 0.4, I had this function to generate a plot for use in an IJulia notebook:
function writemime(io::IO, ::MIME"image/png", x::Figure)
# The plot is written to /tmp/gaston-ijula.png. Read the file and
# write it to io.
data = open(readbytes, "$(gnuplot_state.tmpdir)gaston-ijulia.png","r")
write(io,data)
end
Following the discussion in JuliaLang/julia#14052, I changed the function definition to
function show(::MIME"image/png", io::IO, x::Figure)
I also import Base.show instead of Base.writemime; I also tried reversing the order of MIME and io. However, when I try plotting in a notebook, I get the textual description of the plot, not the plot itself. How should I update my code to make it work again?
(I'm not sure if this is the right forum for this question, but nothing seems to be an obvious fit. Please let me know if I should post this somewhere else.)
The text was updated successfully, but these errors were encountered:
Your arguments are in the wrong order. Define @compat function Base.show(io::IO, ::MIME"image/png", x::Figure) (with @compat there if you want to support 0.4 too).
I'm trying to update Gaston for use in IJulia after the writemime() deprecation in Julia 0.5
In Julia 0.4, I had this function to generate a plot for use in an IJulia notebook:
Following the discussion in JuliaLang/julia#14052, I changed the function definition to
I also import Base.show instead of Base.writemime; I also tried reversing the order of MIME and io. However, when I try plotting in a notebook, I get the textual description of the plot, not the plot itself. How should I update my code to make it work again?
(I'm not sure if this is the right forum for this question, but nothing seems to be an obvious fit. Please let me know if I should post this somewhere else.)
The text was updated successfully, but these errors were encountered: