Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a set of numbers:

[9, 8, 6, 4000]

I want to plot a bar chart and I want to normalize only the 4000 number to 4, so the range of Y axis will be [0, 9]. Under the 4 bar I would write * 1000 so the user would know that this value is normalized.

But I don't want to normalize a set of numbers like this:

[1500, 2000, 3500, 4000]

In that case the range would be [0 - 4000].

Is this possible to achieve with some simple math formula?
How can i define the limit for normalizing?

Set can have more than four elements!

share|cite|improve this question
This seems to be no math question. Anyway, scaling just one bar in a bar plot is evil. – Dirk Mar 13 '12 at 14:34
Something is definitely not right with your sampling data. You cannot have such a variation in results. – Kirthi Raman Mar 14 '12 at 14:24
@KirthiRaman, thats not a very good conclusion. What if he was dealing with random samples attributing the average income of the household or something. Outliers and Black Swans will always exist. In fact, the lack of such events in statistics should make you skeptical about your approach. – Inquest Mar 14 '12 at 16:35
English is subject to misinterpretation. I meant that he has only 4 values? with such a big range? I am not following whats your point? – Kirthi Raman Mar 14 '12 at 16:45

Brute Force always helps:

Pseudo Code:

vec_min = min(A);
vec_max = max(A);
deciding_factor = log10(max/min);
if(deciding_factor) > 1
for i=1:length(A)
A(i) = A(i) / 10^(floor(deciding_factor));
print(i was normalized);
<Do something to keep track of what was normalized>

I used floor to approximate downwards.

I used log10 to determine how many orders of magnitude the max element is from the minimum element.

share|cite|improve this answer
You could add absolute or abs() in case you want to compare magnitudes. – Inquest Mar 13 '12 at 14:51

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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