Adding pdf/png into existing pgfplots

Elyco
Tue, 08 Nov 2022 10:32:02 +0000
General Usage

Hi,
I’m trying to add a node to a pgfplot that contains a pdf/png file.

Here is what I have until now

using Plots
pgfplotsx()
fig1 = plot(1:5)
savefig(fig1, "fig1.png")
savefig(fig1, "fig1.pdf") # just to create a figure in the folder
fig2 = plot([1,2])
plot!(fig2,[NaN],add=raw"\pgfdeclareimage{img}{fig1.pdf}
\node (img1) at (1.5,1.25) {\pgfuseimage{img}};", extra_kwargs=:subplot)

But the file is not presented in the figure.
The node tex code is taken from a stack question.

I’ve already tried

f_pdf = load(file)
heatmap!(fig,f_pdf)

But it complains about memory issue, which I don’t understand (in pfgplotsx() backend).

3 posts - 2 participants