Skip to content

Commit 2705f6a

Browse files
committed
Next try (save as png if GLMakie is loaded, it cannot save as pdf)
1 parent 7a34aab commit 2705f6a

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

ext/VortexStepMethodMakieExt.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ function VortexStepMethod.save_plot(fig::Makie.Figure, save_path, title; data_ty
254254

255255
!isdir(save_path) && mkpath(save_path)
256256
full_path = joinpath(save_path, title * data_type)
257+
fallback_path = joinpath(save_path, title * ".png")
257258

258259
@debug "Attempting to save figure to: $full_path"
259260
@debug "Current working directory: $(pwd())"
@@ -269,6 +270,14 @@ function VortexStepMethod.save_plot(fig::Makie.Figure, save_path, title; data_ty
269270
@info "File does not exist after save attempt: $full_path"
270271
end
271272
catch e
273+
# GLMakie cannot export vector formats such as PDF/SVG directly.
274+
# If that happens, save as PNG so batch example runs keep working.
275+
if e isa MethodError && lowercase(data_type) in (".pdf", ".svg")
276+
@warn "Vector export format $data_type is not supported by the active Makie backend; falling back to PNG" requested_path=full_path fallback_path=fallback_path
277+
save(fallback_path, fig)
278+
@debug "Figure saved as PNG fallback"
279+
return nothing
280+
end
272281
@error "Error saving figure: $e"
273282
@error "Error type: $(typeof(e))"
274283
rethrow(e)

0 commit comments

Comments
 (0)