Matplot using on Node-RED

Hi all, Is it possible to do matplot on NodeRED dashboard using pythonshell or exec node ?

Where will the output go? To a screen, a Jupyter notebook, a web page?

If to a screen, then it would likely be better to use Node-RED's Dashboard directly rather than introduce several additional layers.

If a notebook then that should be possible as long as you can serialise the data you need to pass and then unserialise it in Python.

If a web page, again, it would be easier to do it directly in Node-RED.

That's fine. I used a python shell and wrote the file path. When i tried to use the inject node to activate the node, it couldn't pass anything else than an empty string. Is it because of the debug node ? If yes, what should i use ?

There is an option on the exec node to add data from the input msg (e.g. the inject node) as an additional string to the command being executed.

If the data is too complex to be passed on the command line, you will need to write it to a file.

The debug node has nothing to do with it.

I require the matplot to come out when I click on the inject node. But nothing is coming out. If i run the file separately on my windows cmd it works.

Sorry, I don't use matplot so I have no context about what might be going on. Unless you can explain more, it is hard to help.

Have you connected all the outputs of the exec node to debug nodes to see if anything coming out?

Does a window with the matplot come out if we run a script with plot on NodeRED ?

I don't see how that question answers my question. However, if you expect the exec node to be able to open a window you are probably going to be disappointed. Remember the UI for node red runs in a browser, which may not even be on the same machine as node red.

The program ran on my local pc and opened a window when the plot for matplot has to show something. But the instance running on my remote server is unable to open it.

You still haven't answered that question. It is difficult to help if you don't provide information.

Do you mean the node-red flow worked when run locally? If so then how do you know that it did not open a window if the server is remote? The exec node runs in the server so it would open on the remote machine not the local one.

There is no error from the exec or pythonshell node. The remote server may need a python idle. The remote VPS has only terminal,no desktop environment. It only a server without a desktop. so it mightn't be able to show me the plot popping up.

If it has not got a display then how could it show a window, and if it is remote what use would it be for you anyway?

@Colin The VPS runs my NodeRED instance which has my sensor parameter monitoring system. I wanted to do some data analytics algorithms on the data.so that's the reason.

Please read what Colin stated.

Node-red runs on a VPS, if you use an exec/shell node to launch a matlib window, this will be launched on the VPS, which has no screen. This will not work. You need the data locally and render locally.

If you run the command in a terminal does it give you the answer back in the terminal?

No. It throws a segmentation fault error.

I understood clearly @bakman2

You said earlier:

Now you say it throws an error.

@Colin NodeRed instance on my local windows PC runs ok, but the remote instance throws the error because of no desktop environment.