I have >1 million data points so I utilize the alpha when plotting.
# set up axes
ax1 = fig.add_subplot(121)
ax2 = fig.add_subplot(121)
ax3 = fig.add_subplot(122, sharey = ax1)
# two y-axis
ax2 = ax1.twiny()
# invert y-axis
ax1.invert_yaxis()
# plotting
p1 = ax1.plot(kh['TORQUE.AVG'], kh['DEPTH'], label = 'Torque (kft-lb)', color = 'green', marker = '.', alpha = 1/60)
p2 = ax2.plot(kh['ROP.AVG'], kh['DEPTH'], label = 'ROP (ft/hr)', color = 'black', marker = '.', alpha = 1/60)
p3 = ax3.plot(kh['WOB.AVG'], kh['DEPTH'], label = 'WOB (klb)', color = 'red', marker = '.', alpha = 1/60)
Now when I have two lines that shares the same plot, I wrote the following code to include both lines in one legend.
# legend
p_total = p1 + p2
legends = [i.get_label() for i in p_total]
ax1.legend(p_total, legends)
ax3.legend()
However, because I used alpha now my legend is affected and I essentially cannot see my legend.