Sorry I'm a python noob.
I've been trying to find the max value in an 2D array representing x,y values.
The max value should then be replaced by 0 and plotted. However i have tried many ways to replace the value and i cant get the value replaced.
My code so far is
m2= [ [ 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 ] , [ 0 , 1 , 2 , 3 , 2 , 1 , 0 , 1 , 2 , 3 ]]
a2 = np.array(m2, dtype=np.int)
plt.plot(a2[0,:], a2[1,:], 'r-x')
a2maxy = np.max(a2[1,:])
print("a2 y values: ", a2[1,:])
for y in (a2[1,:]):
if (y==a2maxy):
print(y)
print("max found ", y)
y=0
print(y)
But my output (showing the max y value as unchanged is
a2 y values: [0 1 2 3 2 1 0 1 2 3]
3
max found 3
0
3
max found 3
0
[[0 1 2 3 4 5 6 7 8 9]
[0 1 2 3 2 1 0 1 2 3]]