小编Mic*_*ham的帖子

Mathematica中的Plotlegend不适用于函数表

我试图在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)

plot wolfram-mathematica

1
推荐指数
1
解决办法
1426
查看次数

标签 统计

plot ×1

wolfram-mathematica ×1