Gadfly.jl
Gadfly.jl copied to clipboard
How to supress output to stdout?
In https://github.com/JuliaLogging/TensorBoardLogger.jl/pull/127 I'm constantly getting
Compose.Image{Compose.PNGBackend}(IOBuffer(data=UInt8[...], readable=true, writable=true, seekable=false, append=true, size=30688, maxsize=Inf, ptr=1, mark=-1), Cairo.CairoSurfaceBase{UInt32}(Ptr{Nothing} @0x0000000000000000, 535.0, 378.0), CairoContext(Ptr{Nothing} @0x0000000000000000, Cairo.CairoSurfaceBase{UInt32}(Ptr{Nothing} @0x0000000000000000, 535.0, 378.0), Ptr{Nothing} @0x0000000006376250), 534.5059133378628, 377.9527559055118, RGBA{Float64}(0.0,0.0,0.0,0.0), RGBA{Float64}(0.0,0.0,0.0,1.0), Float64[], Compose.LineCapButt(), Compose.LineJoinMiter(), true, 0.3mm, 3.880555555555555mm, "Helvetica Neue,Helvetica,Arial,sans", nothing, false, Compose.ImagePropertyState[], Compose.ImagePropertyFrame[], Dict{Type, Union{Nothing, Compose.Property}}(), true, false, nothing, true, true, 3.7795275590551185, nothing, nothing)
On the cmd on each show(...)
The source is at https://github.com/JuliaLogging/TensorBoardLogger.jl/blob/d5842d17802e3b8b42d295ccd31c4f14ed4b0d32/src/Optional/Gadfly.jl Is there a way to avoid this?
in julia in general to suppress output put a semicolon at the end of the line. just like matlab.
Thanks for the quick response.
I did actually try it and it didn't work (line 14 in the link), so it's probably something with render
?
try on line 15.
your syntax is unusual for lines 10-15. if you're trying to define a function, then it should be:
function preproces...
...
end
not sure what you're trying to do with a begin
block.
Thanks for that additional catch.
I've tried the semicolon in all these places just now, still no dice...
Is there some way you would approach how to track down the print that's going on?
It seems to come from Compose since we're seeing Compose.Image
here, no?
I can reproduce the print on the REPL with:
using Gadfly, Cairo, Fontconfig
pb = PipeBuffer();
p = plot(x=rand(100), Geom.point);
show(pb, MIME("image/png"), render(p));
I did a bit more investigating. I think the output we are seeing is coming from this line in the Compose code or somewhere around that.. Still trying to figure out the code, so any help is welcome :smiley:
might try reducing your MWE to sth that just uses Compose and not Gadfly. if you can do that, then cross-post an issue to Compose.
I'm working on putting together that MWE, just stopping to mention this line
img.emit_on_finish && typeof(img.out) == IOBuffer && display(img)
In some cases, which is our case I suspect, img.emit_on_finish
is true