Message Boards Message Boards

Print a variable in degrees on the canvas in Manipulate

I think I wrote everything right but I don't get the result I want... I want to print the value of an angle in degrees onto the canvas of Manipulate. But after many attempts, I always get the variable written in radians. (Sorry for the greek letter)

Manipulate[degree = Degree@\[Phi]; 
 Show[Graphics@Text[ToString[degree]]], {{\[Phi], 45 \[Degree]}, 
  0 \[Degree], 90 \[Degree]}]

Does not work as I intend...


POSTED BY: Jean Guy Lussier
3 Replies

Another variation on the theme:

 Graphics@Text[Row[{\[Phi], Degree}]], {{\[Phi], 45}, 0, 90}]
POSTED BY: Gianluca Gorni
In[1]:= Manipulate[\[Phi] , {\[Phi], 0 Degree, 90 Degree, Degree}]

In[2]:= Manipulate[Graphics@Text@(ToString@(\[Phi]/Degree) Degree), {\[Phi], 0 Degree, 90 Degree, Degree}]

enter image description here

Degree is not a function--rather it is a parameter. So you do not want Degree@, (i.e., no @) and also yo want to divide by Degree in your definition of degree as in the following:

 With[{degree = \[Phi]/Degree},
  Graphics@Text[ToString[degree]]], {{\[Phi], 45 Degree}, 0 Degree, 
  90 Degree}]

In this I also localized your definition of degree using With as well as removed the unnecessary Show.

POSTED BY: David Reiss
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract