# Matplot using on Node-RED

**URL:** <https://discourse.nodered.org/t/matplot-using-on-node-red/18162>\
**Category:** General\
**Created:** [19 November 2019 19:37 UTC](https://discourse.nodered.org/t/matplot-using-on-node-red/18162 "2019-11-19T19:37:19Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![ALOKA1432](https://avatars.discourse-cdn.com/v4/letter/a/3ab097/32.png) [@ALOKA1432](https://discourse.nodered.org/u/ALOKA1432)\
**Post date:** [19 November 2019 19:37 UTC](https://discourse.nodered.org/t/matplot-using-on-node-red/18162/1 "2019-11-19T19:37:19Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [19 November 2019 21:46 UTC](https://discourse.nodered.org/t/matplot-using-on-node-red/18162/2 "2019-11-19T21:46:57Z")

</div>

> [@ALOKA1432](#):
>
> matplot

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.

---

<div class="post-metadata">

**Author:** ![ALOKA1432](https://avatars.discourse-cdn.com/v4/letter/a/3ab097/32.png) [@ALOKA1432](https://discourse.nodered.org/u/ALOKA1432)\
**Post date:** [20 November 2019 04:50 UTC](https://discourse.nodered.org/t/matplot-using-on-node-red/18162/3 "2019-11-20T04:50:44Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [20 November 2019 06:26 UTC](https://discourse.nodered.org/t/matplot-using-on-node-red/18162/4 "2019-11-20T06:26:58Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ALOKA1432](https://avatars.discourse-cdn.com/v4/letter/a/3ab097/32.png) [@ALOKA1432](https://discourse.nodered.org/u/ALOKA1432)\
**Post date:** [20 November 2019 06:39 UTC](https://discourse.nodered.org/t/matplot-using-on-node-red/18162/5 "2019-11-20T06:39:52Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [20 November 2019 07:07 UTC](https://discourse.nodered.org/t/matplot-using-on-node-red/18162/6 "2019-11-20T07:07:27Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [20 November 2019 07:25 UTC](https://discourse.nodered.org/t/matplot-using-on-node-red/18162/7 "2019-11-20T07:25:01Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ALOKA1432](https://avatars.discourse-cdn.com/v4/letter/a/3ab097/32.png) [@ALOKA1432](https://discourse.nodered.org/u/ALOKA1432)\
**Post date:** [20 November 2019 07:37 UTC](https://discourse.nodered.org/t/matplot-using-on-node-red/18162/8 "2019-11-20T07:37:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [20 November 2019 07:57 UTC](https://discourse.nodered.org/t/matplot-using-on-node-red/18162/9 "2019-11-20T07:57:12Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ALOKA1432](https://avatars.discourse-cdn.com/v4/letter/a/3ab097/32.png) [@ALOKA1432](https://discourse.nodered.org/u/ALOKA1432)\
**Post date:** [20 November 2019 08:07 UTC](https://discourse.nodered.org/t/matplot-using-on-node-red/18162/10 "2019-11-20T08:07:51Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [20 November 2019 09:03 UTC](https://discourse.nodered.org/t/matplot-using-on-node-red/18162/11 "2019-11-20T09:03:21Z")

</div>

> [@Colin](#):
>
> Have you connected all the outputs of the exec node to debug nodes to see if anything coming out?

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

> [@ALOKA1432](#):
>
> 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

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.

---

<div class="post-metadata">

**Author:** ![ALOKA1432](https://avatars.discourse-cdn.com/v4/letter/a/3ab097/32.png) [@ALOKA1432](https://discourse.nodered.org/u/ALOKA1432)\
**Post date:** [20 November 2019 09:17 UTC](https://discourse.nodered.org/t/matplot-using-on-node-red/18162/12 "2019-11-20T09:17:39Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [20 November 2019 09:19 UTC](https://discourse.nodered.org/t/matplot-using-on-node-red/18162/13 "2019-11-20T09:19:56Z")

</div>

> [@ALOKA1432](#):
>
> 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?

---

<div class="post-metadata">

**Author:** ![ALOKA1432](https://avatars.discourse-cdn.com/v4/letter/a/3ab097/32.png) [@ALOKA1432](https://discourse.nodered.org/u/ALOKA1432)\
**Post date:** [20 November 2019 09:22 UTC](https://discourse.nodered.org/t/matplot-using-on-node-red/18162/14 "2019-11-20T09:22:27Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [20 November 2019 09:24 UTC](https://discourse.nodered.org/t/matplot-using-on-node-red/18162/15 "2019-11-20T09:24:21Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [20 November 2019 09:24 UTC](https://discourse.nodered.org/t/matplot-using-on-node-red/18162/16 "2019-11-20T09:24:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ALOKA1432](https://avatars.discourse-cdn.com/v4/letter/a/3ab097/32.png) [@ALOKA1432](https://discourse.nodered.org/u/ALOKA1432)\
**Post date:** [20 November 2019 09:26 UTC](https://discourse.nodered.org/t/matplot-using-on-node-red/18162/17 "2019-11-20T09:26:03Z")

</div>

No. It throws a segmentation fault error.

---

<div class="post-metadata">

**Author:** ![ALOKA1432](https://avatars.discourse-cdn.com/v4/letter/a/3ab097/32.png) [@ALOKA1432](https://discourse.nodered.org/u/ALOKA1432)\
**Post date:** [20 November 2019 09:26 UTC](https://discourse.nodered.org/t/matplot-using-on-node-red/18162/18 "2019-11-20T09:26:46Z")

</div>

I understood clearly @bakman2

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [20 November 2019 09:28 UTC](https://discourse.nodered.org/t/matplot-using-on-node-red/18162/19 "2019-11-20T09:28:07Z")

</div>

You said earlier:

> [@ALOKA1432](#):
>
> If i run the file separately on my windows cmd it works.

Now you say it throws an error.

---

<div class="post-metadata">

**Author:** ![ALOKA1432](https://avatars.discourse-cdn.com/v4/letter/a/3ab097/32.png) [@ALOKA1432](https://discourse.nodered.org/u/ALOKA1432)\
**Post date:** [20 November 2019 09:30 UTC](https://discourse.nodered.org/t/matplot-using-on-node-red/18162/20 "2019-11-20T09:30:26Z")

</div>

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

[Next page](https://discourse.nodered.org/t/matplot-using-on-node-red/18162.md?page=2)
