gmx_MMPBSA icon indicating copy to clipboard operation
gmx_MMPBSA copied to clipboard

Add support for Plotly

Open Valdes-Tresanco-MS opened this issue 2 years ago • 1 comments

Plotly is a fairly robust web plotting tool. Advantage:

  • Generate very cool graphics, both static images, and interactive graphics.
  • Allows saving in the same formats as matplotlib
  • Includes similar color palettes as seaborn
  • Complex graphics can be made (e.g. heatmap with categories in rows and columns)
  • Works with pandas Dataframes
  • Has graphics not implemented natively in matplotlib/seaborn
  • Render well
  • Easy to customize
  • Easy to update charts with new data
  • [Update] With hardware acceleration it is ~7.5 times faster than matplotlib

Disadvantages:

  • Being interactive, as well as the need to launch multiple QtWebEngine threads makes it consume quite a lot of RAM resources. [Update] 50-90MB per plot, depending on chart type and data size
  • For small data, it works very well, but when the data exceeds 1000 it requires hardware acceleration to run smoothly and render well. [Update] It seems not to be a problem. See the description in more details below

Other technical questions:

  • I need to get familiar with Plotly
  • Implement it as an alternative to seaborn and matplotlib, until making the relevant performance and functionality comparisons. [Update] Given the characteristics and differences with matplotlib, it will definitely be an option, although it is probably the default option. See the description in more details below
  • Implement all current functionalities

I think it can be implemented for version 2.0

Recommended by Dr. Carlos Alessandro Fuzo

Valdes-Tresanco-MS avatar Oct 09 '21 05:10 Valdes-Tresanco-MS

Some points related to the disadvantages: Each graphic is rendered in an HTML interface, so several QtWebEngineProcess (4) are created that consume about 50-90 MBs of RAM. This means that it will consume 50-90 MBs more than matplotlib representing the same graph. Rendering doesn't seem to be a problem, although I have to do tests on less powerful hardware. If you have a GPU that supports WebGL2.0, then it works extremely well, if not, use the CPU (I need to test it) as matplotlib

Based on my tests with a df of 200,000 frames, it draws the figure in just 0.73 s (using hardware acceleration), while seaborn/matplotlib takes about 5.5s. Its implementation is very worthwhile, the user will be the one who decides what he wants: a fast, efficient, interactive graphic, but with greater RAM resources or a slower drawing, little interaction, and less RAM

Valdes-Tresanco-MS avatar Oct 11 '21 06:10 Valdes-Tresanco-MS