I know how to plot twin y-axis but for my problem, I need to make a twin y-axis in percentages (like 0.1 = 10% to 1 = 100%) and here the maximum value or the end point of the line graph should be matched with '1' i.e.100%.
For example: x = 1,3,6,8
& y=2,7,9,17
now if we plot this we know the highest point is (8,17) then w.r.t. this point(8,17) I need to show on the twin y-axis as '1' the twin y-axis can be a dummy axis as it is just needed as a reference axis to compare the graph.
I tried using normalization method but the original plot is getting disturbed and also the y-axis points are displayed according to new twin axis not with the original y-axis values.
For reference, this is the current output:
Below is my code which I tried.
import numpy as np
import matplotlib.pyplot as plt
#below x and y points can be changed according to the user
y = np.array([0, 38, 71, 99, 123, 205])
x = np.array([0, 0.37, 0.74, 1.11, 1.48, 1.85])
fig = plt.figure()
ax1 = fig.add_subplot(111)
ax1.plot(x, y,'b--')
yrep = y-min(y[:])
yrep = yrep/max(yrep[:])
print (yrep,"yrep")
ax2 = ax1.twinx()
ax2.plot(x, yrep, alpha=0)
plt.show()