# Setting LegendLabel in Mathematica ListPlot

I searched many times but could get a simple way to get my desired output. The problem is this: In creating ListPlot, and using LegendLable like

LegendLabel -> Placed[Subscript[x, y] "for a=", Above]


why I am getting the output as "for a= Subscript[x, y]" and not "Subscript[x, y] for a= ". What could be a simple solution for it? I tried "ToString" also like

Placed[Subscript[x, y]<>ToString[ "for a="], Above]


But no success.

• Placed[ToString[Subscript[x, y] // TraditionalForm ] <> ToString["for a="], Above]? Oct 24, 2022 at 15:42
• LegendLabel -> Placed[StringForm[" for a=", Subscript[x, y]], Above] Oct 24, 2022 at 23:29
• Many thanks, @cvgmt. It solved the issue. Oct 25, 2022 at 18:16
• Thanks, @BobHanlon. It also worked. Oct 25, 2022 at 18:16

Let's look at the inner expression:

Subscript[x, y] "for a="


Mathematica is going to interpret this as multiplication (the expression is syntactically incorrect as it stands, so Mathematica will default to considering juxtaposed expressions as representing a multiplication):

Subscript[x, y] "for a=" // FullForm
(* Times["for a=", Subscript[x, y]] *)


Mathematica has specific rules for how to normalize arithmetic expressions (i.e. how to order the arguments). What you want to do is choose a construct for placing expressions into a particular arrangement. There are many of these, but maybe the one you want is Row:

Row[{Subscript[x, y], "for a="}, " "]
`