如何設置Controller以顯示或隱藏Manipulate的圖形組件?在Mathematica中使用Manipulate顯示或隱藏組件
Manipulate[Graphics[
{Pink, Disk[{1, 1}, r],
Green, Disk[{2, 2}, r]}],
{{r, 0.5, Style["Radius", Black, 16]}, 0.5, 5, 1,
Appearance -> "Labeled"}]
例如,在上文中,如何可以設置一個控制器,用於顯示或不綠圈?
- 解決方案:
Manipulate[Graphics[{
If[thePink,
{Pink, Disk[{1, 1}, r]}],
If[theGreen,
{Green, Disk[{2, 2}, r]}]
}
],
{{r, 0.5, Style["Radius", Black, 16]}, 0.5, 5, 1,
Appearance -> "Labeled"},
{{thePink, True, "Pink"}, {True, False}},
{{theGreen, False, "Green"}, {True, False}}]
啊,似乎大家都想通了在同一時間! En Francais:「Les grands esprits se rencontrent」;) – 500 2011-06-07 22:46:09
沒問題。我不確定你是否回來編輯你的答案,因爲我已經準備好了代碼... – Simon 2011-06-08 00:47:14