The code below:
import numpy as np
import matplotlib.pyplot as plt
plt.plot(x, x+np.log10(2), color = 'blue', linestyle = ':', label = r'$ doubled \quad \bf{ y=2*x }$')
plt.plot(x, x-np.log10(2), color = 'green', linestyle = ':', label = r'$ halved \quad \bf{ y=0.5*x }$')
plt.legend(fontsize = 15)
produces a plot where the mathematical part of the second label y=0.5*x
is shifted to the left relative to the mathematical part of the first label y=2*x
; is it possible to modify something (automatically) so that both y
start at exactly the same level?
Well, by "automatically" I mean some instruction/code that would avoid manually adding \,
symbols in the second label, until the alignment works more or less well...