Friday, December 30, 2011

Moving the legend location in Maxima/Gnuplot

I had a plot where the function graph intersected the legend at its default position in the upper right hand corner.  I finally found a command which will move it to the lower right instead.  I'm sure you can move it to where you like, but this is the only one I found so far.  The command is:

[gnuplot_preamble,"set key bottom"]


For example,

plot2d([legendre_p(0, x), legendre_p(1, x), legendre_p(2, x),legendre_p(3, x), legendre_p(4, x), legendre_p(5, x)], [x, 0, 2], [y, -2, 5], [legend,"P_0 (x) = 1","P_1 (x) = x","P_2 (x) = (1/2)*(3*x^2 - 1)", "P_3 (x) = (1/2)*x*(5*x^2 - 3)","P_4 (x) = (1/8)*(35*x^4 - 30*x^2 + 3)","P_5 (x) = (1/8)*x*(63*x^4 - 70*x^2 + 15)" ], [ylabel,"P_n (x)"], [gnuplot_preamble,"set key bottom"]);


Found this here: http://maxima.sourceforge.net/maxima-gnuplot.html

No comments:

Post a Comment