azogue / psychrochart

A Python 3 library to make psychrometric charts and overlay information on them.
MIT License
103 stars 27 forks source link

Add customizable annotations #44

Closed tadashiorigami closed 1 year ago

tadashiorigami commented 1 year ago

Add bbox styling to annotations, stretch the constant h line if constant_h_labels_loc is negative, making the chart look more like the ASRAE default one

azogue commented 1 year ago

Hi @tadashiorigami πŸ‘‹, thank you so much for contributing πŸ₯³

It looks very good πŸ‘, but it has some collateral damage that I would like to avoid, as, after this change, by default unless specifically configured:

(that's why there are so many changes in the SVGs stored in tests/example-charts)

⚠️ In addition, it looks like you had some problems with the character encoding? I see the unicode error generated in the SVG (($οΏ½C$)), which come from the temperature units, defined as Β°C, always using 'Β° DEGREE SIGN Unicode: U+00B0, UTF-8: C2 B0'. That character is different from the usual 'ΒΊ MASCULINE ORDINAL INDICATOR Unicode: U+00BA, UTF-8: C2 BA' in english ANSI keyboards. Not sure what kind of keyboard or python locale config are you using, but everything should run fine with standard UTF-8. Please, open a separate issue if experiencing a problem with this πŸ‘

I will make changes to revert to the previous behaviour (no bbox and color following curve color), by modifying the new AnnotationStyle model, and also remove the bboxs in default_chart_config.json πŸ‘

Then I'll increase the version, update the changelog, and publish a new release πŸš€

azogue commented 1 year ago

BTW @tadashiorigami , about

stretch the constant h line if constant_h_labels_loc is negative

do you have any example of this scenario?, so we can add it to the tests suite Already done, got the notebook addition πŸ‘

tadashiorigami commented 1 year ago

Thanks a lot for the merge! That was really quick! As I made a bunch of changes at once, I thought it would take longer for it to be merged. I'm using a Brazilian ABNT keyboard, for some reason I got into some issues when reading/writing without specifying the UTF-8. I'll check it in a separate fork.