fix static image generation to use --dpi#425
Conversation
|
Much appreciated! Could you limit the changes in nanoplot/NanoPlot.py to just what was necessary for the dpi? There are quite some imports that have changed back to the top. I moved them to other locations to make --version and --help much faster, and only import e.g. pandas and numpy when those are necessary for the code. Also the |
|
@wdecoster Sorry for the messy PR, I hope that this In Thanks, |
|
Thanks! I'll push this to pypi soon. |
|
Each call to try:
start_time = time.time()
pio.get_chrome()
time_taken = time.time() - start_time
sys.stderr.write(f"Plotly successfully found Chrome in {time_taken:.2f} seconds.\n") |
|
Wow it did not on my machine, I tested my files fastq.gz and produced all htmls and static files in around 20 seconds. |
|
Hrm okay that would not be too bad indeed. In my case this is on WSL, would that explain the difference? |
|
Honestly not sure, I was testing on two machines that both have very high speed internet but also saw in a quick google search can possibly be a first time thing? If you try it again is it still slow? |
|
Hmm, every NanoPlot execution in the test was slow here. The first one was even 100 seconds. I must say that the whole static image generation from Plotly is a rather frustrating experience. |
|
I absolutely agree, will certainly be on the lookout for alternatives in the near future. |
|
I have been considering dropping it from NanoPlot entirely and just stick to HTML, but I don't know how many users would be terribly annoyed by that. |
This was a tricky one but I think it's finally there. Had to create the write_static_image function to export the images at the higher dpi than the default 72 that plotly uses. Minimal tests on a fastq.gz file output the high dpi static images and can be seen in the scripts/agm_tests folder of this branch.
I really hope this does the trick long-term but if there are issues with it please don't be afraid to @ me.
Should fix #424 but I recommend a quick test yourself @wdecoster before merging branches.