equinor / wishing-well

Team repo for Wishing Well team - Virtual summer internship 2020
1 stars 1 forks source link

Fixing matplotlib GUI not showing up when running from Docker container #6

Open TorsteinOtterlei opened 4 years ago

TorsteinOtterlei commented 4 years ago

I now put in instructions for fixing the GUI in the README in the helloworld branch: https://github.com/equinor/wishing-well/tree/helloworld

You can try it out and see if it is working for you. It is not an optimal solution since you have to install an external program. However, it will work with whatever program we throw at it as long as it supports linux, not just matplotlib. The jupyter approach did not work well since I found no way to send the local code or image to a jupyter notebook. I will look into something like this https://mpld3.github.io/ so that we might not need that extra program install, but it will work for now if you want to start running your code with it.

TorsteinOtterlei commented 4 years ago

Showing matplotlib in the browser is really easy, as explained here: https://stackoverflow.com/questions/26454257/how-to-show-matplotlib-charts-in-browser-html

It should not be hard to transfer this and use it with Docker containers. However, this solution is not suitable if we want to be able to iteratively draw on the plot for cool visualization purposes.

As we can see here, there are other backends to choose from, including "nbAgg" which can render to a Jupyter notebook: https://matplotlib.org/3.1.0/tutorials/introductory/usage.html

I will test that before I'm happy with this issue.

TorsteinOtterlei commented 4 years ago

Ended up with implementing the solution as linked above. This solution works great, but does not support iteratively drawing on the plot. However, it does support interacting with the plot, and should also support 3D.

Jupyter was not a good idea because while it supported the plotting, we would have to open the notebook and manually start the code. Also I did not test it, but I doubt that it would support iterative plotting as the problem with this seems to be the code running in the background sending data to the plot. I assume what happens behind-the-scenes here, is that the entire plot is saved as a separate figure, translated to javascript, and then sent to the browser. This would not allow for iterative plotting no matter what approach I chose.