Plotting in Pluto with GLMakie

I have a function that creates a Makie plot. I want it to display that plot by default, but to also return other information, let’s say fig and ax, so it can be called as fig, ax = myplot(x). I’m using show == true && display(fig) in the function so as to have the option to avoid displaying the figure.
So far everything is great so far, but the problem is how to make it easy to show the figure in Pluto as well. I know that myplot(x)[1] will do the trick, but would it be possible to show it with directly with myplot(x) or to find a more elegant solution?

Thanks!

Howdy, would just adding a semicolon to the end of your function call to suppress output work?

fig, ax = myplot(x);

and then in another cell:

fig # Display fig as usual

Makie does this same thing with the FigureAxisPlot type, it’s a single return value so display can work automatically once show is overloaded, but it also has an iterate overload so the fig, ax, p = ... thing works.