cphyc / matplotlib-label-lines

Label line using matplotlib.
MIT License
301 stars 28 forks source link

ENH: Implemented y-axis-based labeling #136

Open pevoz23 opened 1 year ago

pevoz23 commented 1 year ago

Should close #121

pevoz23 commented 1 year ago

Thanks for the implementation! This looks good overall, but I have slight concerns about backward compatibility. Also, would it be possible to add test(s) for this? To do so, please read pytest-mpl doc and add the reference image in labellines/baseline.

Note about tests: there is some tiny variation from one run to another on Github Action, leading to some tests failing. I haven't been able to troubleshoot it, but you can keep an eye on the tests results found in the artifacts of the runs.

Hey! Thanks for your review! I agree with all your comments and will work on them as soon as possible (likely in the next few days).

kavanase commented 3 months ago

Just to bump, this would be a very useful feature if it could be included! Our use case is for labelling the chemical formulae of materials in phase diagrams (used in computational materials science research), and we have some smart algorithms for picking the label positions, but for vertical lines we can't set y so it always places the label at the y-midpoint which isn't always desirable (e.g. "P" here):

image image
cphyc commented 3 months ago

I'd be happy for someone to review the PR once the comments have been fixed (this one, or an offspring of it retaining authorship to @pevoz23) but I unfortunately do not have the time to do this myself.