Jul-03-2019, 11:08 AM
Hi,
I am confused in math/logic behind automatically by-default setting of x-axis and y-axis limits in bar graph ? Here i am sharing some examples
1.
In this bar graph, X axis limits are 0,1,2,3,4,5 and Y axis limits are 0,200,400,600,800,1000. How is happened??
2.
In this bar graph, X axis limits are 0,20,30,40,50,60,70,80,90 and Y axis limits are 0,2,4,6,8,10. How is happened??
I am confused in math/logic behind automatically by-default setting of x-axis and y-axis limits in bar graph ? Here i am sharing some examples
1.
1 2 3 4 5 |
import matplotlib.pyplot as plt x = [ 1 , 2 , 3 , 4 , 5 ] y = [ 1000 , 1002 , 1001 , 1003 , 1005 ] plt.bar(x,y) plt.show() |
2.
1 2 3 4 5 |
import matplotlib.pyplot as plt x = [ 20 , 30 , 90 , 70 , 50 , 60 , 80 , 70 ] y = [ 3 , 2 , 5 , 10 , 3 , 9 , 7 , 6 ] plt.bar(x,y) plt.show() |