您可以標記線,你喜歡使用這種方法的基礎上,我先前的職位here。標記後,沒有動態內容的情節可以被設置爲plainplot
。
它通過將每一行變成一個自我貼標籤按鈕來工作。您可以修改labels
以獲得不同的標籤。
l = {10, 20, 30, 40};
y[x_, s_] := 4 x/s + 2
plot = Plot[[email protected][y[x, u], {u, l}], {x, 0, 100},
PlotLabel -> Style["y vs X ", FontSize -> 18]];
pos = Position[plot, _Line];
Array[(line[#] = plot[[Sequence @@ pos[[#]]]]) &, [email protected]];
AddLabel[label_] := Module[{},
AppendTo[plot[[1]], Inset[Framed[label, Background -> White], pt]];
(* Removing buttons for final plot *)
plainplot = plot;
Array[
(plainplot[[Sequence @@ pos[[#]]]] =
plainplot[[Sequence @@ Append[pos[[#]], 1]]]) &, [email protected]]]
labels = ToString /@ l;
Array[
(plot[[Sequence @@ pos[[#]]]] =
Button[line[#], AddLabel[labels[[#]]]]) &, [email protected]];
Dynamic[EventHandler[plot,
"MouseDown" :> (pt = MousePosition["Graphics"])]]
![enter image description here](https://i.stack.imgur.com/P4A1u.png)
請閱讀使用說明書,以獲取有關語法 –