Currently, I can display the plot in maxima as follows:
f(x) := sin(x)$
g(x) := cos(x)$
plot2d([f(x), g(x)], [x,-5,5],[legend,"sin(x)","cos(x)"],
[xlabel,"x"],[ylabel,"y"],
[gnuplot_preamble,"set key box spacing 1.3 top right"])$
And save the plots with the command:
plot2d([f(x), g(x)], [x,-5,5],[legend,"sin(x)","cos(x)"],
[xlabel,"x"],[ylabel,"y"],
[pdf_file,"./trigplot.pdf"],
[gnuplot_preamble,"set key box spacing 1.3 top right"]
)$
How to display and save the plot in maxima simultaneously?