2
$\begingroup$

I have a huge data and I want to add two labels to the Histogram. the problem here is that the labels are calculated and added automatically to the histogram. for example if I have the following Histogram:

Histogram[RandomVariate[NormalDistribution[0, 10], 20000], 20, 
 LabelingFunction -> (Placed[Rotate[Style[#1, Bold, 14], 90 Degree], 
     Above] &), 
 ColorFunction -> Function[{height}, ColorData["Rainbow"][height]]]

enter image description here

In this Histogram, the Bars labels are calculated automatically. I want to add the percentage of each number at the top of the number. something like the following handmade Histogram :

enter image description here

$\endgroup$

1 Answer 1

3
$\begingroup$

Ok I got it:

Histogram[RandomVariate[NormalDistribution[0, 10], 20000], 20, 
 LabelingFunction -> (Placed[
     Column[{Rotate[Style[#1/20000. "%", Red], 90 Degree], 
       Rotate[Style[#1, Bold, 14], 90 Degree]}], Above] &), 
 ColorFunction -> Function[{height}, ColorData["Rainbow"][height]]]
$\endgroup$

Your Answer

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

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