Reputation: 4290
In this chart how do I multiply all labels in the X-axis by a constant?
It still needs to be automatic, only scaled by a 0.4 factor
0 → 140
would become 0 → 56
in this example.
My current code:
ind = np.arange(baby.shape[0])
width = 1
p1 = plt.bar(ind, baby, width)
p2 = plt.bar(ind, adult, width, bottom=baby)
p3 = plt.bar(ind, rain, width, bottom=adult+baby)
p4 = plt.bar(ind, snoring, width, bottom=rain+adult+baby)
p5 = plt.bar(ind, street, width, bottom=snoring+rain+adult+baby)
plt.legend((p1[0], p2[0], p3[0], p4[0], p5[0]), ('Bebê', 'Adulto', 'Chuva', 'Ronco', 'Externo'))
plt.show(block=False)
Upvotes: 1
Views: 54
Reputation: 339765
Usually you would not fake the labels, but rather plot the data you want to show. In this case
width = 1*0.4
plt.bar(ind*0.4, baby, width)
Upvotes: 2