GangCaoLab / CoolBox

Jupyter notebook based genomic data visualization toolkit.
https://gangcaolab.github.io/CoolBox/index.html
GNU General Public License v3.0
224 stars 37 forks source link

TypeError in Arcs() due to Argument Mismatch with matplotlib.patches.Arc #97

Closed skelviper closed 4 months ago

skelviper commented 4 months ago

Hello Developer,

I am a huge fan of CoolBox and it has significantly improved my productivity. I've encountered an issue with the Arcs() function when it calls matplotlib. The error message I receive is:

TypeError: Arc.__init__() takes 4 positional arguments but 7 were given

This seems to be due to the current function definition in matplotlib, which is structured as follows:

class matplotlib.patches.Arc(xy, width, height, *, angle=0.0, theta1=0.0, theta2=360.0, **kwargs)

Here, the fourth positional argument is an asterisk *, indicating the end of positional arguments and the start of keyword-only arguments.

In the coolbox implementation located at coolbox/core/track/arcs/plot.py on line 106, the call to the Arc constructor does not comply with the new matplotlib interface. I suggest modifying this line to use keyword arguments as follows:

arc = Arc(
    xy=(center, 0), 
    width=diameter,
    height=height, 
    angle=0, 
    theta1=0, 
    theta2=180,
    color=color,
    alpha=alpha,
    lw=line_width,
    linestyle=properties['line_style']
)

This change should resolve the TypeError by matching the expected signature of the Arc constructor in the latest version of matplotlib.

Thank you for your attention to this issue.

Best regards, Zhiyuan Liu

Nanguage commented 4 months ago

Hi Zhiyuan,

I'm very sorry, I currently don't have the time and energy to maintain this project. Thank you very much for your suggestion. If you could submit a Pull Request, I would be happy to merge it.

wbszhu commented 4 months ago

Hi, i have fix this issue. can you try again?

$ git clone https://github.com/GangCaoLab/CoolBox.git
$ cd CoolBox
$ python setup.py install
skelviper commented 4 months ago

Thanks !!!