Hello,
This is really a very basic question, but I find the short examples given on https://makie.juliaplots.org a bit confusing regarding which instruction(s) to use to actually display a figure, apart from typing its variable name in the REPL (I am using CairoMakie from within VSCode with the Julia extension, in case that matters).
My confusion comes from the fact that some functions (e.g. barplot
) return a figure and seem to magically force showing it. But other functions such as barplot!
show nothing. From the examples, it seems that I have to first create a figure, then an axis (because somehow creating a figure does not create a default axis?), then plot into that figure, and just type the name of that figure to force showing it, as in:
using CairoMakie
f = Figure()
a = Axis(f[1,1])
p = barplot!([1,2], [10,11])
f # This actually shows the figure
Now the fun part is that if the code above is within a script, and I want to do something useful after plotting, I have no idea how to show the figure, except by adding a line with f
at the very end of the script (or using the REPL to type f
once the script has run).
using CairoMakie
f = Figure()
a = Axis(f[1,1])
p = barplot!([1,2], [10,11])
f # This actually shows the figure... But NOT if it's not the last instruction!
# Some useful stuff
x = 4
# The figure is not shown
I tried show(f)
but this prints some lines of information in the REPL.
Is there some other function I missed?
Thanks!
PS. Speaking about Makie documentation, some examples show that barplot! for example can be used with a first argument which is an axis (barplot!(a, ...)
in the example above). Where would I find which arguments are accepted?
I found this page: https://makie.juliaplots.org/v0.17.5/examples/plotting_functions/barplot/index.html
Some examples use an axis, sometimes as first argument (with just the axis variable name), sometimes with a axis = (...)
argument. Is there a list of arguments somewhere? Help obtained with ?barplot!
in the REPL does not even mention a possible argument before x and y.