3
$\begingroup$

I want to plot a function for different values of my parameter, 'y_a', where a is a subscript. Here is my code:

f1[x_] := x/0.15 - 1/0.8
f2[x_] := x/0.25 - 1/0.8
f3[x_] := x/0.45 - 1/0.8

Plot[{f1[x], f2[x], f3[x]}, {x, 0, 0.9}, PlotTheme -> "Monochrome", 
 AxesLabel -> {"x","f(x)"}, PLotLabels -> {"y_a=0.15","y_a=0.25","y_a=0.45"}]

When I execute my code, an extra space between the function and the labels is generated, if I use ctrl+- command to create a subscript. So, I would be grateful if you could tell me how I can remove this extra space.

$\endgroup$
4
$\begingroup$
Plot[{f1[x], f2[x], f3[x]}, {x, 0, 0.9}, 
 PlotTheme -> "Monochrome", 
 AxesLabel -> {"x", "f(x)"}, 
 PlotLabels ->  Placed[Pane[ToString[Subscript[y, a],StandardForm]<>" = " 
  <>ToString @ #]& /@ {0.15, 0.25, 0.45}, After]]

enter image description here

$\endgroup$
  • $\begingroup$ My question was uncleared. Please have a look at my improved question $\endgroup$ – Yorgos Oct 16 at 12:00
  • $\begingroup$ @Yorgos, please see the updated answer. $\endgroup$ – kglr Oct 16 at 12:05
2
$\begingroup$
Plot[{f1[x], f2[x], f3[x]}, {x, 0, 0.9}, PlotTheme -> "Monochrome", 
AxesLabel -> {"x", "f(x)"}, 
PlotLabels -> {Row[{Subscript[y, a], "=", 0.15}, "\[ThinSpace]"], 
Row[{Subscript[y, a], "=", 0.25}, "\[ThinSpace]"], 
Row[{Subscript[y, a], "=", 0.45}, "\[ThinSpace]"]}]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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