Skip to content

Commit 1f1321f

Browse files
authored
Merge pull request #297 from jgray-19/plot_improvements
Plot PNG files
2 parents 53376f7 + 64ba8e7 commit 1f1321f

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/madl_plot.mad

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,16 @@ local function setup_cmd (self)
283283
file:write("MAD_TERM = \"set term ${term} ${output} size ${wsizex},\z
284284
${wsizey} enhanced font '${font},${fontsize}'\"\n" % self)
285285
elseif is_string(output) then
286-
file:write("MAD_TERM = \"set term pdfcairo enhanced font \z
287-
'${font},${fontsize}'; set out '${output}'\"\n" % self)
286+
local ext = output:sub(-3, -1)
287+
if ext == "png" then
288+
file:write("MAD_TERM = \" set term png enhanced font '${font},\z
289+
${fontsize}' size ${wsizex},${wsizey}; set out '${output}'\"\n" % self)
290+
elseif ext == "pdf" then
291+
file:write("MAD_TERM = \"set term pdfcairo enhanced font \z
292+
'${font},${fontsize}'; set out '${output}'\"\n" % self)
293+
else
294+
error("unsupported output file extension '".. ext .. "'")
295+
end
288296
end
289297

290298
file:write("@MAD_SET_TERM\n")

0 commit comments

Comments
 (0)