I wanna try create location wise stacked bar chart I used following code
example of data
values are based on different different altitude on particular location
location N T S Su
1 25 20 30 40
:
:
N
code:=
import numpy as np
import matplotlib.pyplot as plt
N=np.array([20, 35, 30, 35, 27])
T=np.array([25, 32, 34, 20, 25])
S=np.array([30,5,35,10,20])
Su=np.array([30,5,35,10,20])
No =len(N)
ind = np.arange(No) # the x locations for the groups
width = 0.35 # the width of the bars: can also be len(x) sequence
p1 = plt.bar(ind, N, width, color='r')
p2 = plt.bar(ind, T, width, color='y',bottom=N)
p3=plt.bar(ind,S,width,color='g',bottom=N+T)
p4=plt.bar(ind,Su,width,color='w',bottom=N+T+S)
plt.ylabel('Scores')
plt.title('Scores by group and gender')
plt.xticks(ind+width/2., ('G1', 'G2', 'G3', 'G4', 'G5') )
plt.yticks(np.arange(0,200,10))
plt.legend( (p1[0], p2[0],p3[0],p4[0]),
('Normal','Trapping','Super','Sub') )
plt.show()
It work on only for single value of T,N,S,Su
but some time on particular lat,long value for T,N,Su,S will repeat that should be adjust in stack bar but I unable to do it please help me
value of T,N,S,Su grouped respectively have same colour based on grouped on single stack bar or all
example location T N S Su N T S N
1 25 30 35 40 45 50 55 60
:
:
N
In this example N ,S has multiple value for single location on different altitude similarly there are N number of location and have similar condition please help me and give the solution

