I use this Manipulate in a package:

Manipulate[Plot[Sin[a1 x1], {x1, -2 Pi, 2Pi}], {a1, 1,5}, Text["y=a1 sin(x)"]];

In the notebook, near the slider that is created, there is Pack Private a1. How can I write something istead of that? Or just a1?

 Plot[Sin[a1 x1], {x1, -2 Pi, 2 Pi},
  PlotLabel -> "y = sin(a1 x)"],
 {{a1, 1}, 1, 5, Appearance -> "Labeled"}]

enter image description here

  • $\begingroup$ I don't see a1 but again Pack Private a1 $\endgroup$
    – Ale1794
    May 19 '17 at 15:08
  • $\begingroup$ @Ale1794 - Try starting with a fresh kernel. $\endgroup$
    – Bob Hanlon
    May 19 '17 at 15:09
  • 1
    $\begingroup$ Put this code between Begin["MyPackage`Private`"] and End[] to see the problem $\endgroup$
    – Kuba
    May 19 '17 at 15:15
  • $\begingroup$ @BobHanlon I mixed you solution with the Shadowray one: Manipulate[Plot[Sin[a1 x1], {x1, -2 Pi, 2 Pi}, PlotLabel -> "y = a*sin(x)"], {{a1, 1,"a"}, 1, 5, Appearance -> "Labeled"}] $\endgroup$
    – Ale1794
    May 19 '17 at 15:17

You can add any text label for Manipulate parameter like this:

    Plot[Sin[a1 x1], {x1, -2 Pi, 2 Pi}], 
    {{a1, 1, "my label for a1"}, 1,  5}

This method does not depend on the $Context and will show the same label even when called from package (i.e. when your variable is called Pack`Private`a1).

See also: examples on the Manipulate help page.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.