0

This is a simple variation/spin off of this question, but I am having trouble. In the second example in the original question, I'm trying to get the $a=$ in the PlotLabel to be in TraditonalForm (with an italicized $a$ instead of a non-italic a).

testplot[a_] := Plot[a x^2, {x, 0, 3}, PlotLabel -> StringForm["a=`1`", a]]

testplot[2]

Edit: Here's my particular example of this issue in v10

   Table[ContourPlot[Norm[{x, y}, p] == 1, {x, -1.2, 1.2}, {y, -1.2, 1.2}, 
   PerformanceGoal -> "Accuracy", ImageSize -> 250, 
   PlotLabel -> Text["p=" <> ToString@p, FormatType -> TraditionalForm]], 
   {p, {1, 2, 3, 4, 10, 50, 500}}]
Carl Woll
  • 130,679
  • 6
  • 243
  • 355
JohnD
  • 3,301
  • 3
  • 22
  • 42

2 Answers2

2

I believe this accomplishes your goal:

Table[ContourPlot[
   Norm[{x, y}, p] == 1, {x, -1.2, 1.2}, {y, -1.2, 1.2}, 
   PerformanceGoal -> "Accuracy", ImageSize -> 250, 
   PlotLabel -> Row[{TraditionalForm[HoldForm[p]], "\[ThinSpace]=", p}]], 
   {p, {1, 2, 3, 4, 10, 50, 500}}]

The \[ThinSpace] is included just to properly space before the equal sign.

murray
  • 11,888
  • 2
  • 26
  • 50
0

I would avoid strings and just use an expression (Mathematica by default formats labels in TraditionalForm):

Table[
    ContourPlot[
        Norm[{x,y},p]==1,
        {x,-1.2,1.2},
        {y,-1.2,1.2},
        PlotLabel->HoldForm[p]==p
    ],
    {p,{1,500}}
]

enter image description here

In comparison to the accepted answer, note that the labels use a long equal sign instead of a regular equal sign, and the spacing on either side of the equal sign is even.

Carl Woll
  • 130,679
  • 6
  • 243
  • 355