coolprop icon indicating copy to clipboard operation
coolprop copied to clipboard

Inline Labels - Python Plotting

Open lgpage opened this issue 12 years ago • 6 comments

In-line Labels for iso-lines are currently broken. Checklist for this:

  • ~~get in-line label code to work~~ (removed old code - e10d463c9bedda8a4d82d8dfc7c9240e92e03749)
  • ~~clean up current code~~ (removed old code - e10d463c9bedda8a4d82d8dfc7c9240e92e03749)
  • ~~add basic in-line labels that rotate with the line gradient~~ (e6e89c3266934d4104e65cfac5134768228303c7)
  • add methods for in-line label placements:
    • ~~center: place labels strictly centered below one another, nearest the a given x-coordinate~~ (c299093fb69767a528ce7a4a48077b4509e6425b)
    • ~~manual: place labels strictly nearest the given x-coordinates (one for each line)~~ (c299093fb69767a528ce7a4a48077b4509e6425b)
    • auto: float / adjust the label placements to minimize overlap, nearest the given x-coordinate
    • pyplot: use ContourSet and clabel methods from matplotlib.pyplot
  • update web documentation

lgpage avatar Oct 18 '13 14:10 lgpage

Shall we move this to 4.0?

ibell avatar Oct 18 '13 14:10 ibell

Let me first see how far I can get with this in the next week before moving it to v4.0

lgpage avatar Oct 18 '13 15:10 lgpage

anyone know of an easy way to test if two matplotlib text objects overlap? I have a solution in mind, but it will require some coding, so If you know of a simple solution please let me know.

lgpage avatar Oct 23 '13 15:10 lgpage

You can get the bounding box for each and then check the minimum and maximum values I think.

On Wed, Oct 23, 2013 at 5:04 PM, lgpage [email protected] wrote:

anyone know of an easy way to test if two matplotlib text objects overlap? I have a solution in mind, but it will require some coding, so If you know of a simple solution please let me know.

— Reply to this email directly or view it on GitHubhttps://github.com/ibell/coolprop/issues/56#issuecomment-26912586 .

ibell avatar Oct 23 '13 15:10 ibell

I tried looking into the bounding box of the text, unfortunately I cannot make heads or tails of the transform object that gets applied to the text and bbox. All I've been able to get is the local transform bounds between 0 and 1. For now I'll carry on with the solution I have in mind and see what I can come up with.

lgpage avatar Oct 25 '13 07:10 lgpage

This is turning out to be more of a fight that I thought. I can have a manual label placement method done for v4.0, but I doubt that I'll be able to get an optimized label placement method (to minimize overlapping) done.

lgpage avatar Oct 29 '13 12:10 lgpage