I have a huge data set from which I derive two sets of datapoints, which I then have to plot and compare. These two plots differ in their in their range, so I want them to be in the range of [0,1]
. For the following code and a specific data set I get a constant line at 1 as the dataset plot, but this normalization works well for other sets:
plt.plot(range(len(rvalue)),np.array(rvalue)/(max(rvalue)))
and for this code :
oldrange = max(rvalue) - min(rvalue) # NORMALIZING
newmin = 0
newrange = 1 + 0.9999999999 - newmin
normal = map(
lambda x, r=float(rvalue[-1] - rvalue[0]): ((x - rvalue[0]) / r)*1 - 0,
rvalue)
plt.plot(range(len(rvalue)), normal)
I get the error:
ZeroDivisionError: float division by zero
for all the data sets. I am unable to figure out how to get both the plots in one range for comparison.