Skip to content

Compiling small Makie plotting script with trimming #111

@jclsn

Description

@jclsn

I would like to compile me a small plotting script, but the compilation fails when I enable --trim=safe. I know Makie is quite heavy and probably a tough case.

Can you see some possible issues in the code that I could improve though to make the build more deterministic and easier to trim?

Here is the log: https://0x0.st/PatT.log

using GLMakie, WAV

function safe_open(filename, mode)
        try
            file = open(filename, mode)
            return file
        catch e
            println("Error opening file: ", e)
            exit()
        end
end


function @main(ARGS)

    if length(ARGS) > 0
        filepath = ARGS[1]
    else
        return
    end

    y, Fₛ = wavread(filepath)

    ch_a = y[:,1]
    ch_b = y[:,2]

    N = size(y)[1]

    x = (1:N)

    # Init plot with dark mode
    lw = 1
    f = Figure(backgroundcolor = "#0f111b")
    ga = f[1, 1] = GridLayout()
    ax = Axis(ga[1, 1],
              title = basename(filepath),
              titlecolor = "#ece0e1",
              xlabel = "samples",
              ylabel = "amplitude",
              xlabelcolor = "#ece0e1",
              ylabelcolor = "#ece0e1",
              backgroundcolor = "#0f111b",
              xgridcolor = "#ece0e1",
              ygridcolor = "#ece0e1",
              topspinecolor = "#ece0e1",
              bottomspinecolor = "#ece0e1",
              leftspinecolor = "#ece0e1",
              rightspinecolor = "#ece0e1",
              xticklabelcolor = "#ece0e1",
              yticklabelcolor = "#ece0e1",
             )

    # Add graphs
    ch_a_lines = lines!(ax, x, ch_a, label = "CH-A"; linewidth = lw)
    ch_b_lines = lines!(ax, x, ch_b, label = "CH-B"; linewidth = lw)
    axislegend(ax, backgroundcolor = "#0f111b", framecolor = "#ece0e1", labelcolor = "#ece0e1")

    display(f)

    println("Plotting finished. Press enter to close")
    read(stdin, Char)
    GLMakie.closeall()
    exit()

    return 0
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions