legend scaling

• To: mathgroup at smc.vnet.net
• Subject: [mg54446] legend scaling
• From: Chris Chiasson <chris.chiasson at gmail.com>
• Date: Sun, 20 Feb 2005 00:10:48 -0500 (EST)
• Reply-to: Chris Chiasson <chris.chiasson at gmail.com>
• Sender: owner-wri-mathgroup at wolfram.com

```Dear MathGroup,

Below, I have attached code that is part of one of my homework
assignments in my powertrain class. The code contains all input
statements up to and including a graph I am working on. I mapped
steady state 100% throttle engine power to top gear vehicle speed for
power onto the same graph. My concern is with the legend below the
graph. If I change the ImageSize->600 argument in the last command,
the legend box becomes larger or smaller. How do I make sure that no
matter what size I choose for the ImageSize, that the legend always
stays nicely wrapped around the legend text? Thank you in advance for

EngineTorqueVsEngineSpeedData=
5700},{61.0,67.6,73.7,78.5,80.9,77.3,76.2,73.3,68.7} kg m^2/s^2/
EnginePowerVsEngineSpeedData={#1,#1 #2}&[Sequence@@#]&/@
EngineTorqueVsEngineSpeedData;
EnginePowerVsEngineSpeed=
Sequence@@#]&/@
DrivelineEfficiency[TransmissionReductionRatio_]=
1-(0.06+TransmissionReductionRatio^1.5/100);
FinalDriveReductionRatio=(*Interval[{Min[#],Max[#]}&@Rationalize[*){2.95,3.55,
3.73}(*]]*);
RollingResistanceCoefficient=0.015;
CoefficientOfDrag=0.335;
Area=2 m^2;
g=9.81 m/s^2;
CurbWeight=g 1350 kg;
AirDensity=100000/(286.9*298.15) (kg/m^3);
CarSpeed*(1/2*AirDensity*CarSpeed^2*CoefficientOfDrag*Area+
N[DesiredTopSpeed=140 km/h*1000 m/km/(3600 s/h)];
CarSpeedAtTopEngineSpeed=
CarSpeed/.EngineSpeed->EngineTorqueVsEngineSpeedData[[-1,1]];
TypeBTopSpeedDifference=DesiredTopSpeed-CarSpeedAtTopEngineSpeed;
LastGearReductionRatioSolution=
Map[Solve[# ==0,TransmissionReductionRatio][[1]]&,
TypeBTopSpeedDifference,{2}];
DisplayLastGearReductionRatio=
Array[junk,Drop[Dimensions[LastGearReductionRatioSolution],-1]+1];
DisplayLastGearReductionRatio[[
Sequence@@(Range[
2,#]&/@(Drop[
Dimensions[LastGearReductionRatioSolution],-1]+1))]]=
TransmissionReductionRatio/.LastGearReductionRatioSolution;
DisplayLastGearReductionRatio[[1,
Range[2,#]&[Length[FinalDriveReductionRatio]+1]]]=
FinalDriveReductionRatio;
DisplayLastGearReductionRatio[[1,1]]="4th Gear";
TableForm[DisplayLastGearReductionRatio//N,
"Ratio"}}]
TopGearNVRatio=
EngineTorqueVsEngineSpeedData[[-1,1]]/
CarSpeedAtTopEngineSpeed/.TransmissionReductionRatio\[Rule]1;
Needs["Graphics`MultipleListPlot`"]
MultipleListPlot[
Append[#,Level[#,{Length@Dimensions@#}-1]&@
ReplaceAll[#,Line[pts_]\[RuleDelayed]List/@pts]&@
First@Block[{\$DisplayFunction=Identity},
ReleaseHold[#]]&@
Hold[Plot[
W/.W->1/1000,{CarSpeed,0,160}]]]&@
Level[#,{2}]&@(#/.kg m^2/s^3->W/.W->1/1000/.{m\[Rule]1/1000,
s\[Rule]1/3600}/.TransmissionReductionRatio\[Rule]1)&@
Map[ReleaseHold@
ReplacePart[Function[{CarSpeedDummyVariable},Null],
Apply[{Hold[CarSpeedDummyVariable/.EngineSpeed\[Rule]#1],
DrivelineEfficiency[TransmissionReductionRatio] #2}&,
EnginePowerVsEngineSpeedData,{1}],2],CarSpeed,{2}],
PlotJoined\[Rule]True,
SymbolShape\[Rule]Append[#,None]&@
Length[FinalDriveReductionRatio]]&@
Apply[PlotSymbol[#1,Filled\[Rule]#2]&,#,{1}]&@Flatten[#,1]&@
Outer[List,{Box,Diamond,Star,Triangle},{True,False}],
Level[Outer[
", Final Drive Reduction Ratio: "<>ToString[#2]&,RollingRadius,
FinalDriveReductionRatio],{2}],ImageSize\[Rule]600,
LegendSize\[Rule]{1.6,0.5},LegendPosition\[Rule]{-.75,-1.25},
LegendSpacing\[Rule]-.3,LegendTextSpace\[Rule]Automatic,
AxesLabel\[Rule]{"Speed (kph)","Power (kW)"},

Regards,
--
Chris Chiasson
Kettering University
Mechanical Engineering