Disable warnings in `Plots`

I am using Plots to plot(data,options...). This produces tons of Warnings like:

┌ Warning: Indices Base.OneTo(7) of attribute `fillcolor` does not match data indices 1:6.
└ @ Plots ~/.julia/packages/Plots/AAjgN/src/utils.jl:128
┌ Warning: Indices Base.OneTo(7) of attribute `markercolor` does not match data indices 1:6.
└ @ Plots ~/.julia/packages/Plots/AAjgN/src/utils.jl:128
┌ Warning: No strict ticks found
└ @ PlotUtils ~/.julia/packages/PlotUtils/igbcf/src/ticks.jl:191
┌ Warning: No strict ticks found
└ @ PlotUtils ~/.julia/packages/PlotUtils/igbcf/src/ticks.jl:191

like, these are useful, but I can generate the plots I want now. Is there a way to disable them (like verbosity=false) so that my REPL don’t get spammed asunder?

You can do:

julia> using Logging

julia> Logging.disable_logging(Logging.Info)
LogLevel(1)

julia> @warn "test"
┌ Warning: test
└ @ Main REPL[6]:1

julia> Logging.disable_logging(Logging.Warn)
LogLevel(1001)

julia> @warn "test"

See the docs Logging · The Julia Language for more infos.

Edit: I didn’t checked if it is working for your specific warnings you get from Plots, because I wasn’t able to produce some in a timely manner.

2 Likes

Thanks for the reply, I’d probably prefer not having to mess with logging, however, maybe that is the only option. Thanks :slight_smile:

Try this:

using Logging, Plots

with_logger(NullLogger()) do
   plot(data, options...)
end

That will suppress everything.

If you still want to see errors, try this:

with_logger(ConsoleLogger(Error)) do
    plot(data, options, ...)
end
3 Likes