Remove mpld3
Closed this issue · 5 comments
Description
The mpld3
package which is used by the mothulity.utilities.draw_rarefaction
function to produce an interactive rarefaction plot requires matplotlib<=2.0.0
and numpy<=1.13.3
. This, in turn, restricts requires python<3.7
.
The plot produced is not worth the problem it causes. It should be replaced with plain matplotlib
for now. In the future, another solution (probably bokeh or self-crafted d3.js
code) should be used.
@Setnea assigned you as we spoke.
I forgot mpld3
is also used to produce the scatter plot - mothulity.utilities.draw_scatter
.
Another thing to bear in mind is that the way the rarefaction and NMDS plots are embedded into the final report must change. You can see how it is done with other static plots, like dendrograms or heatmaps.
I propose to try out alternative solutions to keep our output in html form.
That way we don't have to change other parts of the report processing, especially that we're planning to make plots more interactive in the future.
It is a great idea, especially that I like the output sample you have shown me in person. Keep in mind that when the report is generated, the rarefaction plot HTML is parsed by bs4
and only selected part of it are embedded into the final HTML report.
The process looks like this:
-
Save the HTML to file with
mothulity_draw
-
mothulity
finds the./alpha/{}raref.html
and parses it withmothulity.utilities.parse_html
-
mothulity.utilities.parse_html
looks fordiv
andscript
tags
mothulity/mothulity/utilities.py
Lines 317 to 319 in 8c4720c
- The output from
mothulity.utilities.parse_html
is passed as one of themothulity.mothulity
template_vars
So, draw_rarefaction
must render HTML with the plot inside a single div
container and there must a proper js
script inside the script
tag
If you find it too cumbersome for the limited time we have, then just use the static image