-1
$\begingroup$

So I have this problem: I'm having to plot the Exponential Integral and another function, but when I come to write the legend to make it to appear in the plot, I don't get the function with the argument, but a reversed writing.

Explaining myself better, this is the code:

Plot[{ExpIntegralEi[x], -ExpIntegralEi[-x]}, {x, -2, 3}, 
PlotRange -> {-5, 7}, 
PlotStyle -> {{Darker[Green], Thickness[0.004]}, {Blue, 
Thickness[0.004]}}, 
PlotLegends -> 
Placed[SwatchLegend[{Darker[Green], 
 Blue}, {Style[TraditionalForm[Ei ( x )]], 
 Style[TraditionalForm[Subscript[ℰ, 1](x)]]}, 
LegendMarkerSize -> {30, 10}], {0.6, 0.8}], 
LabelStyle -> {FontSize -> 11}]

So I want the legend $\text{Ei}(x)$ and $\mathcal{E}_1(x)$.

But what I get is this:

enter image description here

How can I obtain in the legends the writing $\mathcal{E}_1(x)$ and so on?

$\endgroup$

closed as off-topic by Feyre, corey979, happy fish, mikado, MarcoB Oct 22 '16 at 16:43

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." – Feyre, corey979, happy fish, mikado, MarcoB
If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ Try "\!\(\*SubscriptBox[\(\[ScriptCapitalE]\), \(1\)]\)(x)" in an input cell, then copy the out result into the TraditionalForm[] box. $\endgroup$ – Feyre Oct 21 '16 at 12:47
  • $\begingroup$ I'm using strings in such cases; go with {"Ei(x)", "E1(x)"}. $\endgroup$ – corey979 Oct 21 '16 at 12:47
  • 1
    $\begingroup$ For optimum quality use MaTeX github.com/szhorvat/MaTeX $\endgroup$ – grbl Oct 21 '16 at 12:49
  • $\begingroup$ @Feyre Nothing changes... Still the same. The $x$ comes first -.- $\endgroup$ – Henry Oct 21 '16 at 12:53
  • 1
    $\begingroup$ You need to use the ", it works, I tried it, it's basically the same as what @corey979 suggested, only with making sure it gives a script E. $\endgroup$ – Feyre Oct 21 '16 at 12:54
3
$\begingroup$

Enter the labels in normal Mathematica stardard form and let TraditionalForm do the formatting.

Plot[{ExpIntegralEi[x], -ExpIntegralEi[-x]}, {x, -2, 3}, 
  PlotRange -> {-5, 7}, 
  PlotStyle -> {{Darker[Green], Thickness[0.004]}, {Blue, Thickness[0.004]}},
  PlotLegends ->
    Placed[
      SwatchLegend[
        {Darker[Green], Blue}, 
        {TraditionalForm[Ei[x]], TraditionalForm[Subscript[ℰ, 1][x]]}, 
        LegendMarkerSize -> {30, 10}],
      {0.6, 0.8}],
  LabelStyle -> {FontSize -> 11}]

plot

$\endgroup$

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