Question: how to customize a plot legend

 

I'm having problems tweaking legends in plots. I'm using Maple 15 / Standard on Windows 7 - 64 bits.

The first problem I have is that the legend box is too narrow. Is there a way to fix that? The help page does not mention anything to that effect.

http://www.maplesoft.com/support/help/Maple/view.aspx?path=plot/options

I could have the legend above or below and the box would stretch wide enough, but I would prefer to have the legend on the left.

I thought about changing the font size, but couldn't get it to work (see below), is there an obvious way to do that?

EDIT: Changing the font size can be done, works as expected, and is mentioned in the plots/options help file. I ought to have seen it. Silly me. Here's how to do it: 'legendstyle' = [ 'font' = [TIMES,ROMAN,10], 'location' = left ]

functionList := [ exp(-0.6e-1*t), exp(-0.6e-1*t)*exp(-1+exp(-.5*t)) ] :
colorList := [ red , blue ] :
legendList := functionList :
testPlot :=
  plot( [ seq( functionList[k], k = [1,2] ) ]
    , t = 0 .. 100
    , 'colour' = [ seq( colorList[k], k = [1,2] ) ]
    , 'legend' = [ seq( 'D(t)' = legendList[k] , k = [1,2] ) ]
    , 'legendstyle' = [ location = left ]
  ) :

plots:-display(%);


I can control font sizes on the plot, but not within the legend, any suggestions?

testPlot :=
  plot( [ seq( functionList[k], k = [1,2] ) ]
    , t = 0 .. 100
    , 'colour' = [ seq( colorList[k], k = [1,2] ) ]
    , 'legend' = [ seq( 'D(t)' = legendList[k] , k = [1,2] ) ]
    , 'legendstyle' = [ location = bottom ]
    , 'axesfont' = [ TIMES, 6 ]
    , 'labelfont' = [ TIMES, ROMAN, 6 ]
  ) :

plots:-display(%);

The second problem I have is that I would like to control the display precision within the legend as well as striptrailing the zeros, but I couldn't get it to work.

restart;
interface(displayprecision=5):
interface(typesetting=extended):
Typesetting:-Settings(striptrailing=true):
functionList := [ exp(-0.06123456*t), exp(-0.6e-1*t)*exp(-1+exp(-.5*t)) ] :
colorList := [ red , blue ] :
legendList := functionList :
testPlot :=
  plot( [ seq( functionList[k], k = [1,2] ) ]
    , t = 0 .. 100
    , 'colour' = [ seq( colorList[k], k = [1,2] ) ]
    , 'legend' = [ seq( 'D(t)' = legendList[k] , k = [1,2] ) ]
    , 'legendstyle' = [ location = left ]
  ) :

plots:-display(%);

Any other suggestions are always welcome. Thanks!

 

P.S. The plots were exported as jpeg by right-clicking. The default sizes are not optimal when a legend is present, either too narrow for a legend on the sides or too wide for a legend above or below. But I know how to fix that:

inline display extended functionaliy:

http://www.mapleprimes.com/posts/125899-Presized-Plots

ps export workaround:

http://www.mapleprimes.com/questions/125945-Plot-Size-On-Export-With-Maple-15

Please Wait...