Search code examples
juliawarningsvisualizationvega-lite

Julia VegaLite.jl - How to disable the warninigs?


When using the VegaLite.jl library for Julia, it is common to get several warnings when the visualization is not fully specified. For example, if I run the following code:

using VegaLite
α  = rand(10,2)
β  = rand(10,2)
v1 = @vlplot(:circle,x=α[:,1],y=α[:,2])
v2 = @vlplot(mark={"type"=:circle,color="red"},x=β[:,1],y=β[:,2])
@vlplot()+v1+v2

This will plot things correctly, but I get several warnings saying "QARN Missing type for channel "x", using "quantitative" instead".

Is there a way to disable this warnings? I mean, is there a way to suppress them? Note that I'm using Jupyter Notebook.


Solution

  • You can use Suppressor.jl to suppress all warnings.

    Your code would like like this:

    using Suppressor
    @suppress begin
        v1 = @vlplot(:circle,x=α[:,1],y=α[:,2])
        v2 = @vlplot(mark={"type"=:circle,color="red"},x=β[:,1],y=β[:,2])
        @vlplot()+v1+v2
    end
    

    See other usage examples here: https://github.com/JuliaIO/Suppressor.jl#usage