Text, Arrows and Legends - How to use them in... Knowlton Materials Science and Engineering Boise State University

advertisement
Knowlton
Materials Science and Engineering
Boise State University
Text, Arrows and Legends - How to use them in you plots
à We will plotting the activity of component one and two as a function of the fractional amount of 2.aα1
and a'1 α as a function of X2a2 .
To add Arrows and Text, we use the following commands:
Epilog[ ]
Arrow[ ]
Text[ ]
Keep in mind that we have to use the "Graphics" add-on package. To access the package, we use the command:
<<Graphics`Arrow`
Arrows Text and Legends.nb
2
<< Graphics`Arrow` H∗Graphics add−on command to initiate add−on package∗L
Clear@Ta1, X2, T, γa, ao, ∆S1aL, ∆G1aLD
∆G1aL@T_D := HTa1 − TL ∆S1aL
a1a@X1_, T_D := X1 ExpA
ao H1 − X1L2
RT
E
a1prime@X1_, T_D := a1a@X1, TD ExpA
∆G1aL@TD
RT
E
R = 8.314;
ao = 8400;
Ta1 = 1500;
∆S1aL = −9;
Plot@a1a@X1, 300D, 8X1, 0, 1<, Frame → True, GridLines → Automatic,
PlotStyle → 8RGBColor@1, 0, 0D<, FrameLabel → 8"X1 ", "aα1 "<,
PlotLabel −> " aα1 ",
Epilog → 8Arrow@8.4, .25<, 8.18, 1.7<D, Arrow@8.65, .25<, 8.83, .9<D,
Text@"Maximum", 8.4, .12<, 80, −1<D,
Text@"Minimum", 8.65, .12<, 80, −1<D<D;
Null
aα1
1.75
1.5
1.25
aα1
1
0.75
0.5
0.25
Maximum
Minimum
0
0
0.2
0.4
0.6
0.8
X1
Here is another example using Arrows and Text using the commands:
Show[ ]
Epilog[ ]
Arrow[ ]
Text[ ]
1
Arrows Text and Legends.nb
3
<< Graphics`Arrow`
Clear@Ta1, X2, T, γa, ao, ∆S1aL, ∆G1aLD
∆G1aL@T_D := HTa1 − TL ∆S1aL
a1a@X2_, T_D := H1 − X2L ExpA
ao X22
RT
E
a1prime@X2_, T_D := a1a@X2, TD ExpA
∆G1aL@TD
RT
E
R = 8.314;
ao = 8400;
Ta1 = 1500;
∆S1aL = −9;
Plota1a = Table@
H∗Print@"T= ",T," K"D;∗L
Plot@a1a@X2, TD, 8X2, 0, 1<, PlotRange → 8−0.2, 2<, Frame → True,
GridLines → Automatic, PlotStyle → 8RGBColor@1, 0, 0D<,
FrameLabel → 8"X2 ", "aα1 "<,
PlotLabel −> " aα1 − Temp. Range: 300 − 1500 K; Increments: 100 K",
DisplayFunction → IdentityD, 8T, 300, 1500, 100<D;
Show@Plota1a,
Epilog → 8Arrow@8.45, −.125<, 80, .98<D, Hue@.7D,
Arrow@8.84, 1.76<, 8.65, .25<D, Hue@.9D,
Text@"About 1", 8.4, −0.2<, 80, −1<D, Hue@.7D,
Text@"Inc. Temp.", 8.8, 1.8<, 80, −1<D<,
DisplayFunction −> $DisplayFunctionD;
Plota1prime = Table@
H∗Print@"T= ",T," K"D;∗L
Plot@a1prime@X2, TD, 8X2, 0, 1<, PlotRange → 8−0.1, 1.05<,
Frame → True, GridLines → Automatic, PlotStyle → 8RGBColor@0, 0, 1D<,
FrameLabel → 8"X2 ", "a'1 α "<,
PlotLabel −> " a'1 α − Temp. Range: 300 − 1500 K; Increments: 100 K",
DisplayFunction → IdentityD, 8T, 100, 1500, 100<D;
Show@Plota1prime,
Epilog → 8Hue@0D, Arrow@80.2, −0.05<, 8.4, .8<D, Hue@.9D,
Text@"Inc. Temp.", 8.4, .8<, 80, −1<D<,
DisplayFunction −> $DisplayFunctionD;
Arrows Text and Legends.nb
4
aα1 − Temp. Range: 300 − 1500 K; Increments: 100 K
2
Inc. Temp.
1.5
aα1
1
0.5
0
About 1
0
0.2
0.4
0.6
0.8
1
X2
a'1 α − Temp. Range: 300 − 1500 K; Increments: 100 K
1
Inc. Temp.
0.8
a'1 α
0.6
0.4
0.2
0
0
0.2
0.4
0.6
X2
Legends: They are in the graphics package and need to be loaded.
0.8
1
Arrows Text and Legends.nb
5
<< Graphics`Legend`
Plot@8Sin@xD, Cos@xD<, 8x, −2 Pi, 2 Pi<,
PlotStyle → 8GrayLevel@0D, Dashing@8.03<D<,
PlotLegend → 8"Sine", "Cosine"<D
1
0.5
-6
-4
-2
2
4
6
-0.5
Sine
-1
Cosine
Graphics
Legends : Further discriptions of legends are found below with an example.
option name
default value
LegendSpacing
Automatic
space around each key box in the legend, expressed as the ratio of th
LegendTextSpace
Automatic
space allocated next to the key boxes for text, expressed as in Legen
LegendLabelSpace
Automatic
space allocated for the legend label, as in LegendSpacing
LegendBorderSpace
Automatic
space allocated around the entire legend, as in LegendSpacing
LegendBorder
Automatic
style for a border line around the legend box, can only be used if Leg
LegendBackground
Automatic
style for a background to the legend, can only be used if LegendSh
ShadowBackground
GrayLevel[0]
color for the legend’s drop-shadow
Arrows Text and Legends.nb
6
<< Graphics`Legend`
Plot@8Sin@xD, Cos@xD<, 8x, 0, 2 Pi<,
PlotStyle → 8GrayLevel@0D, 8GrayLevel@0D, Dashing@8.03<D<<,
PlotLegend → 8"sin", "cos"<, LegendPosition → 8.5, −.7<,
LegendTextSpace → .5, LegendLabel → "Trig Funcs", LegendLabelSpace → .5,
LegendOrientation → Horizontal, LegendBackground → GrayLevel@.5D,
LegendShadow → 8.1, −.2<, Background → GrayLevel@.8DD
1
0.5
1
-0.5
-1
Graphics
2
3
4
5 Trig 6Funcs
sin
cos
Download