0
$\begingroup$

I plotted a histogram and I used AxesLabel for labeling X axis and Y axis But it went wrong. How to do it?.

Xarray = A @@@ Tuples[Range[0, 9], 3];

M = RandomSample[Xarray, 7]

Table[energies =  RandomVariate[ExponentialDistribution[1.5], {Length@M}];

Total[energies/7], {i, 1000}];

Histogram[%, AxesLabel \[RightArrow] {"Average energy", "Number of times"}]
$\endgroup$
3
  • 3
    $\begingroup$ "But it went wrong" - how? Could you show a picture of what you've tried, and why you're dissatisfied with Mathematica's output? (AxesLabel works fine, BTW.) $\endgroup$ Commented Jul 13, 2012 at 11:54
  • 3
    $\begingroup$ Try Histogram[%, AxesLabel -> {"Average energy", "Number of times"}]. $\endgroup$ Commented Jul 13, 2012 at 11:59
  • 1
    $\begingroup$ ... that is, replace \[RightArrow] with -> or \[Rule]. $\endgroup$
    – kglr
    Commented Jul 13, 2012 at 12:12

1 Answer 1

6
$\begingroup$

\[Rule] is not the same as \[RightArrow]

Compare this (it works):

 r = Table[Total[RandomVariate[ExponentialDistribution[1.5], {7}]/7], {i, 1000}];

 Histogram[r, AxesLabel \[Rule] {"Average energy", "Number of times"}]

With this (does not work)

 Histogram[r, AxesLabel \[RightArrow] {"Average energy", "Number of times"}]

\[Rule] is usually entered as two chars "->"

$\endgroup$

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.