moshi4 / pyCirclize

Circular visualization in Python (Circos Plot, Chord Diagram, Radar Chart)
https://moshi4.github.io/pyCirclize/
MIT License
715 stars 42 forks source link

Rounding issue in sector.py #67

Closed robby-wang closed 4 months ago

robby-wang commented 4 months ago

There's rounding issue in sector.py, around line 210. When there's only one item in the sector, it might have a rounding error.

When I added this code in the if statement: print(self.start, self.end, x) I got: 0 0.23938634812405565 0.23938634812405568

I was able to quickly fix it by changing it to: if not self.start <= x <= (self.end+0.000000000001) and not ignore_range_error:

But I'd imagine there's better fix than this.

Thanks for creating and maintaining pyCirclize, it's a very useful tool!

moshi4 commented 4 months ago

Hi @robby-wang,

Thank you for reporting this bug. I will try to fix it in the next release. Similar issue #27.