0

I am scratching my head in confusion as I am trying to give better aesthetics to the following plot.

enter image description here

import random

my_randoms = [random.randint(0,50) for p in range(600)]
my_randoms += [random.randint(50,1000) for p in range(300)]

bins = range(0, 1000, 50)
plt.hist(my_randoms, bins)
plt.xticks(bins)`enter code here`
plt.yticks(range(0, 500, 50))
plt.grid()
plt.show()

The problem is that i want to set the y axis tick in an non equal way e.g 0, 10,20, 30, 40, 50, 500 but with the same size and no breaking axes.

UPDATE

An awesome drawing of what I have in my mind.NO breaking axis.

enter image description here

UPDATE 2

Well the log-ed transformed values gave the following result. enter image description here

bins = [math.log10(x) for x in range(0, 1000, 50)]
plt.hist(prideG, bins)
plt.xticks(bins)
plt.grid()
plt.show()

On the x axis are the log-ed values of 0-1000 with a step of 50.

19
  • 3
    Do you mean a broken axis? Commented Feb 22, 2018 at 15:42
  • Hmmm, I consider it as last alternative :D. I know that what i want can be done in R for sure but don't know how i matplotlib. What i want is e.g. to have a range from 0 to 50 in ticks of 10 and then another tick of the value 500 and the distance of the tick from 50 to 500 to be equal with that of 0 to 50. Commented Feb 22, 2018 at 15:49
  • That would mean rescaling the data and relabeling the y labels with the inverse applied. Commented Feb 22, 2018 at 15:51
  • I don't get the concept. Suddenly at 50 the scaling changes? This would make a bar representing 95 appear equally far away from 50 as a bar representing 45. I think this representation is very misleading. Is this for your own use only? Commented Feb 22, 2018 at 16:00
  • P.S.: I don't think the question is a duplicate, since this is not the OP's preferred solution. Commented Feb 22, 2018 at 16:11

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.