我试图在Mathematica v8中使用PlotLegend绘制一个带有图例的函数列表.作为一个简单的测试,说明我正在尝试做什么.
<<PlotLegends`
test = Table[f[x], {f, {Sin, Cos, Tan, Log, Exp}}]
Plot[test, {x, 0, 1}, PlotRange -> Full, Axes -> {True, False},
PlotStyle -> Thick, AxesOrigin -> {0, 0},
PlotLegend -> {"Sin", "Cos", "Tan", "Log", "Exp"},
LegendPosition -> {0, -0.5}, LegendShadow -> None]
Run Code Online (Sandbox Code Playgroud)
作为输出
{Sin[x], Cos[x], Tan[x], Log[x], E^x}
Run Code Online (Sandbox Code Playgroud)

但是,如果我明确地将表放在Plot命令中,我会得到正确的图例.
Plot[{Sin[x], Cos[x], Tan[x], Log[x], Exp[x]}, {x, 0, 1},
PlotRange -> Full, Axes -> {True, False}, PlotStyle -> Thick,
AxesOrigin -> {0, 0},
PlotLegend -> {"Sin", "Cos", "Tan", "Log", "Exp"}, …Run Code Online (Sandbox Code Playgroud)