Edinburgh-Genome-Foundry / DnaFeaturesViewer

:eye: Python library to plot DNA sequence features (e.g. from Genbank files)
https://edinburgh-genome-foundry.github.io/DnaFeaturesViewer/
MIT License
584 stars 90 forks source link

Add plotly plotting functionality #50

Open ATayls opened 3 years ago

ATayls commented 3 years ago

To incorporate into a plotly dash dashboard, I needed some functionality to create plotly fig object.

Using the bokeh plotting class as an example, created class PlotlyPlottableMixin that adds the plot_with_plotly method to Graphic record.

Added plot_with_plotly.py to examples and corresponding .html output. Mirrored bokeh tests. Updated readme.

coveralls commented 3 years ago

Coverage Status

Coverage decreased (-1.5%) to 90.18% when pulling 76e993f352215517574025feb4ac34bcf02bb1d4 on ATayls:plotly-plot into 6ace5cdff96bf995aa26167868b0dbb47f5f5952 on Edinburgh-Genome-Foundry:master.

ATayls commented 3 years ago

Travis CI checks were passing at 76e993f. Intermediary checks failed due to cancellation. Unsure why checks are not triggered at latest commit.

veghp commented 3 years ago

Thank you for this contribution. There are no plans currently to support plotly, but will discuss it. In the meantime, your work is not lost and can be installed directly from your fork, even with pip.

As for your question, unfortunately, Travis implemented open source build limitations for each account recently, so ideally you want to develop on your own fork and enable Travis to watch your repos (account is free to set up). Generally, once all your commits pass builds, you can make a PR.

ATayls commented 3 years ago

Thanks for your reply. I'll look into Travis' behaviour on my fork. Originally I didn't intend to draft this PR and but ended up with a few more commits to increase coverage and tidy. From building and running pytest locally I believe this latest commit will pass the Travis check and increase coverage on coverall.

I think it would be great to have a small amount of plotly functionality, similarly to how you have implemented support for bokeh. I really like this package and it would be great to pull some plots into dash dashboards. I don't have any numbers but from my experience I feel Dash/plotly has surpassed bokeh in popularity over the past couple of years.

This PR aims to create plotly plots in an identical manner to the bokeh implementation, so hopefully if that method of using the MatplotlibPlottableMixin class is robust, this should be also.