WebPlots is an Angular web application that runs scrips in Python and R to generate and present visualizations.
For examples of plotting scripts, see examples.md.
- Plotly
- Matplotlib
- Plotly
- GGPlot2
- Angular
- Docker
- Flask
- Plotly.js
The backend runs a docker container that listens on routes /r_runner
and /python_runner
endpoints for POST
requests and executes the contained script as a subprocess.
The output fromm the script is saved as a plotly figure, including conversions from other libraries if needed, and the link to the figure is sent as the response.
The frontend uses an iframe with a blank target at the start. This iframe is updated to the link from the backend when the response is recieved.
- Scripts in R fail due to not being able to find common dataset libraries. Mitigated by pre-installing a wide array of libraries.
- Matplotlib threw errors about having no graphical screen when
plt.plot()
was called. Solved by prependingmatplotlib.use('Agg')
in the script so that the non-graphical plotting backend is used. - Since the frontend and backend were running on the same host(localhost) but the servers were different, the Cross-Origin Resource Sharing (CORS) policy was blocking connections to the backend. This was solved by using the
CORS
module from flask.