Plotting Makie output with Plots

Is there any way to use Plots and Makie together to create a larger figure without having to export one as an image and load it back in? Something like:

using Makie, Plots

mfig = Figure() # ... create Makie figure ...
img = convert_to_img(mfig)
pfig = Plots.plot(img)

The reason for using Makie to do the plotting is because of speed (like repeatedly plotting thousands of polygons), but Plots is much better for TeX support, so I wanted a way to try to get the best of both worlds.

Does this refer to PGFPlotsX or something else?

Sorry I wasn’t clear. I just meant I can easily use LaTeXString with Plots, while with Makie, everything has to be simple strings.

1 Like

Try Makie.colorbuffer(fig.scene) to get an image that you can replot with Plots. We’re currently working on getting a simple latex like engine working so that labels can be given with LaTeXStrings as well.

4 Likes

This was a great workaround for the time being. I got the runtime for creating an animation down from an hour to five minutes (while keeping the pretty LaTeX formatting)!!! It would definitely be even faster to keep everything inside Makie (when that feature is added), but for anyone looking to take advantage of Makie’s fast plotting and Plot’s ease of formatting (LaTeX, subplots, etc.), this worked for me.