2
$\begingroup$

I have a plot, not important what it is and I have a linelegend as below:

PlotLegends -> 
Placed[LineLegend[{Style["K=3", FontSize -> 23], 
Style["K=5", FontSize -> 23], Style["K=7", FontSize -> 23], 
Style["K=9", FontSize -> 23]},

Here all "K" s must be italic but not "=" and the following numbers. In the usual case all are roman. How can I deal with this problem?

$\endgroup$

1 Answer 1

4
$\begingroup$
Plot[{3 x, 5 x, 7 x, 9 x}, {x, -1, 1}, 
 PlotLegends ->  Placed[LineLegend[Row[{Style["K", 23, Italic], 
        Style["=" <> ToString@#, 23]}] & /@ {3, 5, 7,   9}], {After, Top}]]

Mathematica graphics

Or, use

PlotLegends -> Placed[LineLegend[
   Style[ToString[Style[K, Italic], StandardForm] <> "=" <> ToString[#], 23] & /@
     {3, 5, 7, 9}], {After, Top}]
$\endgroup$
1
  • $\begingroup$ @Seyhmus, my pleasure. Thanks for the accept. $\endgroup$
    – kglr
    Commented Apr 9, 2016 at 3:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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