Hi all, I was trying to plot multiple Gadfly plots and display them in two separate figures. However, only the second plot was displayed.
Do I have to explicitly put each plot in display() or is there something that I’m missing when I called the Gadfly plots?
plot doesn’t display a plot by itself, it returns a
Plot object. Those
Plot objects automatically get displayed if they’re the return value of a REPL line or notebook cell, but not otherwise. Here, I’m assuming you’re calling
draw_stuff on the REPL or a notebook, which will return the second line’s
Plot object, so that’ll be the only one displayed.
You can either
display(plot(...)) or add
show = true as an argument to the plot calls:
plot(..., show = true).
(All of the above is based on the general Plots.jl library - I’m assuming Gadfly also provides the same interface, at least with regard to simple things like this. )
display(plot(...)), or possibly
gridstack several plots (lots of examples in the Gadfly Gallery).
Thank you for the explanation!
Thanks for the suggestion! However, I was looking to plot in separate figures rather than in subplots, which seems to be what the stack functions do.