Ben*_*enB 6 wolfram-mathematica
我有一个简短的程序设置,使用Manipulate显示具有不同参数的三个相同功能的图.我想用参数的值标记每个函数.我的出发点是让一个传奇出现.将PlotLegend添加到绘图会导致Mathematica变得非常慢.
我的代码是:
Needs["PlotLegends`"]
Manipulate[
UemaxOverUe = ((VA/Vphs)^2 (2 p - 1) + 1 - Ves0/Vphs - 2)/((VA/Vphs)^2 - (1 - Ves0/Vphs));
UemaxOverUe2 = ((VA/Vphs)^2 (2 p - 1) + 1 - Ves02/Vphs - 2)/((VA/Vphs)^2 - (1 - Ves02/Vphs));
UemaxOverUe3 = ((VA/Vphs)^2 (2 p - 1) + 1 - Ves03/Vphs - 2)/((VA/Vphs)^2 - (1 - Ves03/Vphs));
ListPlot[{
Table[{Vphs/VA, 1/UemaxOverUe}, {Vphs, .001 VA, VA, .01 VA}],
Table[{Vphs/VA, 1/UemaxOverUe2}, {Vphs, .001 VA, VA, .01 VA}],
Table[{Vphs/VA, 1/UemaxOverUe3}, {Vphs, .001 VA, VA, .01 VA}]},
AxesLabel -> {"Vphs/VA", "Ne/NeMax"}, Joined -> True(*,
PlotLegend->{"Blah","Blarg","Word"}*)],
{{p, 1}, 0, 5},
{{Ves0, -2 VA}, -10 VA, 10 VA, .1 VA},
{{Ves02, -2 VA}, -10 VA, 10 VA, .1 VA},
{{Ves03, -2 VA}, -10 VA, 10 VA, .1 VA}
]
Run Code Online (Sandbox Code Playgroud)
取消注释PlotLegend应该重新创建问题.
我的问题是:为什么会这样?
什么是好的解决方案或解决方法?
问题似乎是PlotLegend只是很慢.它没有任何关系Manipulate.在我的电脑上ListPlot如果添加了一个图例则需要0.013秒而没有图例需要0.43秒.
作为一种解决方法,您可以使用
ControlActive[{}, PlotLegend -> {"Blah", "Blarg", "Word"}]]
Run Code Online (Sandbox Code Playgroud)
而不仅仅是PlotLegend当你没有移动滑块时才显示图例.
| 归档时间: |
|
| 查看次数: |
798 次 |
| 最近记录: |