Finally using the amazing Makie for plotting

Hello, tite,

However, it doesn’t let me save my plot, code is here

using CairoMakie

CairoMakie.activate!(type = “svg”)

fig = Figure(pt_per_unit = 2)

ax = Axis(fig[1, 1], xlabel = “GQ”, ylabel = “VAF”,

title = “VAF vs GQ by DeepVariant”)

hexbin!(ax, df[:, “GQ”],df[:, “VAF”])

fig

save(“DeepVariant_hesbin.svg”,fig)

the error is

UndefVarError: save not defined

How can save be undef? It’s the keyword found in the doc
https://docs.makie.org/stable/documentation/backends/cairomakie/

Also examples from here say the same “save not defined” GitHub - MakieOrg/Makie.jl: Interactive data visualizations and plotting in Julia

what am I missing?

You also need using FileIO, I think.

Can you show ] st in the REPL? It should just work:

julia> using CairoMakie

julia> save
save (generic function with 8 methods)

CairoMakie v0.10.7

Does it happen in a fresh environment? Can you give a complete MWE? I don’t get this on v0.10.7.

yes it does work in the REPL. I am running Julia in Visual Studio, what should I do?

Usually this means that you have two packages loaded which are exporting this name

3 Likes

Ok thanks, gonna try CairoMakie.save then?

Yeah that should always work

1 Like

Did the trick

You should have seen a warning in the REPL when you first called save, something like this:

julia> using Plots, CairoMakie

julia> plot
WARNING: both CairoMakie and Plots export "plot"; uses of it in module Main must be qualified
ERROR: UndefVarError: `plot` not defined

so watch out for these.

Correct but as asked, I did the minimal possible so didn’t load other packages.

That seems unlikely, as in that case your code runs without errors (as Daniel showed above, and I just confirmed running your entire example).

Then I am probably suffering from hallucinations and my REPL is haunted. That was a very useful comment

My code ran without error in that case of minimal package loaded as suggested

Yes, it could be that you have not loaded anything else (we can’t check :slight_smile: ), that would be a very strange bug indeed. Almost a Julia bug. Let me just say that from our perspective of helping new users in this forum, it’s much more likely that a user has overlooked something (startup files, env variables, old deved packages, etc.). So it’s not a critique of you per se, or that we don’t believe you. Just a very strong bayesian prior we’ve accumulated over time

Fair enough I accept the prior, but I really promise nothing else waw loaded. I suspect there was a misunderstanding, since I started from a script handed to me into visual studio then went to REPL. Of course it was not explicited, it’s on me. But my comment was more laughing than attacking.

Usually it’s useful to comment the full result from ] st just in case something else was actually loaded / to confirm that for others.