# How to make the command Text a function [closed]

I want to create a function as follows: g[x_]:=Graphics[Text["mean=" x, {a,b}]]. That is at some coordinate point (a,b) the text, mean = x is printed. I get 3mean= when I use this function, i.e. g[3]

## closed as off-topic by Jens, m_goldberg, MarcoB, Yves Klett, Mr.Wizard♦Aug 5 '16 at 13:41

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Jens, m_goldberg, MarcoB, Yves Klett, Mr.Wizard
If this question can be reworded to fit the rules in the help center, please edit the question.

• Use Row or StringTemplate, now you are just multiplying. – Kuba Aug 4 '16 at 13:38
• – Bob Hanlon Aug 4 '16 at 13:54

Try this:

g[x_] := Graphics[Text[Row[{Style["mean=", 16], Style[x, 16]}], {0, 0}]]


Have fun!

I would do

g[x_]:=Graphics[Text["mean="<>ToString[x], {a,b}]]

• g[1/2] is not going to do what you want because of the default behavior of ToString. – Brett Champion Aug 4 '16 at 15:47
• @BrettChampion Ok, it doesn't look nice for $x=1/2$, but it works for $x=0.5$. – corey979 Aug 4 '16 at 16:02