Matplot using on Node-RED

OK, so the command will not run on the server in a terminal, in that case it is not going to run in an exec node either.

@Colin Yup. I have to install a dekstop environment. All are more than a GB. Do you know any lightweight desktop environment for ubuntu ?

I don't think matlab is the right tool for the job. You need to find command line tools that will do whatever you need to do.

Any suggestion?

Since you haven't given a clue about what you are trying to do then no I haven't. However a node-red forum is unlikely to be the best place to ask that.

Reading the matplotlib documentation, instead of spawning a window, you can save the output to an svg or png.
I even see output to plotly, you could use this to show it on the node-red dashboard. These options will limit interactivity compared to a window, but it could work.

1 Like

Thanks @bakman2

Bokeh might be another solution, but the JS side of things when working between python and JavaScript take a lot of time setting up.
https://docs.bokeh.org/en/latest/index.html

Iā€™ve good experience with an environment that is a mix of python and js using Baiduā€™s eCharts.
What I do there is have python do the processing of data, then output all needed info in a dict, which is then converted to json and returned. When doing this with an exec node, you would print the json to stdout, use a json node to get it back in object form, then set up the echarts instance in a dashboard template node and make sure it comes in there. Personally I donā€™t use the dashboard nodes but uibuilder for this but both situations should work.
https://www.echartsjs.com/en/index.html