Hello everyone,
I’m facing an issue with using CairoMakie and Adobe Illustrator 2025 that I hope someone here can help me with. The workflow involves generating some plots with CairoMakie, linking these plots into Illustrator, and exporting the final composition to a PDF. However, I’ve encountered a strange behavior: the CairoMakie plots seem to disappear in the final exported PDF, while plots generated by PyPlot are displayed correctly.
Here’s a minimal working example that illustrates the problem
using CairoMakie
using PyPlot
x_vec = 0:0.1π:2π
y_vec = sin.(x_vec)
##
m_fig = CairoMakie.Figure()
m_ax = CairoMakie.Axis(m_fig[1, 1], title="CairoMakie")
CairoMakie.lines!(m_ax, x_vec, y_vec)
save("sin_makie.pdf", m_fig)
##
p_fig = PyPlot.figure()
p_ax = p_fig.add_subplot(111)
p_ax.plot(x_vec, y_vec)
p_ax.set_title("PyPlot")
p_fig.savefig("sin_pyplot.pdf")
The generated PDFs are initially rendered correctly when opened individually:
However, after linking both PDFs to a new, empty Illustrator file and exporting that Illustrator composition to PDF (using default export settings), only the PyPlot version remains visible in the resulting PDF when opened in any PDF reader. Meanwhile, in Illustrator itself, both plots are correctly displayed (I colored the background to increase the contrast):
Interestingly, I noticed that if I manually select in Acrobat the approximate area where I expect the CairoMakie plot to be and use the “remove crop” option, the plot suddenly becomes visible again:
This suggests the issue might be related to some kind of cropping or clipping behavior, but I’m unsure why CairoMakie plots exhibit this and PyPlot plots do not.
Has anyone experienced similar behavior with CairoMakie, or have any suggestions on how to adjust figure generation or export settings to avoid this? I suspect this could be related to the way CairoMakie handles layers or clipping paths, but I would really appreciate any insights.
Thank you so much for your help!
Thank you,
Lorenzo