1
$\begingroup$

Here is an example of how I would like to show in FrameLabel as 4th argument a Mean of some data which should be in ScientificForm:

data = RandomReal[{1000000, 2000000}, 100];
plot = ListLinePlot[data];
mean = Mean[data];
x2LabelString = StringJoin["Mean=", ToString[ScientificForm[mean]]];
plot = Show[plot, Frame -> True, PlotRange -> {All, All}, 
  ImageSize -> 600,
   BaseStyle -> {FontWeight -> "Bold", FontSize -> 15, 
    FontFamily -> "Calibri"}, 
  FrameLabel -> {{"y1", "y2"}, {"x1", x2LabelString}}]

The result is the following plot:

enter image description here

As one can see the label on the upper plot axis should look different:

enter image description here

How can I do that?

$\endgroup$
2
  • 1
    $\begingroup$ try ToString[ScientificForm[mean], StandardForm] $\endgroup$
    – Kuba
    Jan 22, 2016 at 10:34
  • $\begingroup$ also perfectly working ... thanks $\endgroup$
    – mrz
    Jan 22, 2016 at 11:19

1 Answer 1

4
$\begingroup$

Scientific notation doesn't convert well to a string, you can use Row to combine objects like String and ScientificForm

x2LabelString = Row[{"Mean=", ScientificForm[mean]}];
plot = Show[plot, Frame -> True, PlotRange -> {All, All}, 
  ImageSize -> 600, 
  BaseStyle -> {FontWeight -> "Bold", FontSize -> 15, 
    FontFamily -> "Calibri"}, 
  FrameLabel -> {{"y1", "y2"}, {"x1", x2LabelString}}]

enter image description here

$\endgroup$
0

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.