matplotlib-label-lines
matplotlib-label-lines copied to clipboard
Add xoffsets kwarg
Closes https://github.com/cphyc/matplotlib-label-lines/issues/176 by adding xoffsets as a kwarg, similar to yoffsets. Properly handles both numeric and timedelta offsets.
This lets me get a plot like I was wanting in the original issue!
import matplotlib.pyplot as plt
import numpy as np
from labellines import labelLines
pi_2 = np.pi/2
x = np.linspace(0, pi_2, 100)
fig, ax = plt.subplots()
for i in range(3):
ax.plot(x, np.sin(x) + i, label=f'x{i}')
labelLines(ax.get_lines(), zorder=2.5, xvals=(pi_2 - 1e-12), xoffsets=0.1)
ax.set_xlim(0, pi_2 + 0.2)