# Playing with 'matplotlib' with Python

**URL:** <https://discourse.nodered.org/t/playing-with-matplotlib-with-python/72362>\
**Category:** Share Your Projects\
**Created:** [17 December 2022 19:14 UTC](https://discourse.nodered.org/t/playing-with-matplotlib-with-python/72362 "2022-12-17T19:14:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)\
**Post date:** [17 December 2022 19:14 UTC](https://discourse.nodered.org/t/playing-with-matplotlib-with-python/72362/1 "2022-12-17T19:14:20Z")

</div>

I have a number of sensors around the periphery of my house that report temp/humidity/pressure readings to a database in London (as shown below) and also detect infrared status for my security cameras.

 ![db_readings](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/a/8a86df8621ff6b2ba3af3bd67b68a24748613f70.png)

Whilst helping my grandsons with their Computer Science coursework we took a look at the 'MatPlotLib' library in Python and after they left I thought... "I could use that library to plot some of my T/H/P readings".

My initial step was to create a NR flow to query the dB and send the results, via MQTT, to my Python script.

 ![NR_query_dB](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/e/ce8dd5b86d453995c2db92f7552d47395cd4e3dd.png)

The Python script then plotted this graph.

 ![matplotlib_plot](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/e/be94b9ccdbba9fbef83da8a0cca147633c649df7.png)

I have to admit (_ **wash my mouth out with soapy water** _), I've since modified the Python script so it performs the MySQL query itself, thus avoiding the middle-man (i.e. Node-RED and MQTT transfer).
