Using Plotly from LabVIEW via Python

One of the great things about the Python language is that it talks to nearly everything.  This kind of interoperability means that Plotly, which has Python bindings, can be used from a wide variety of platforms, including some you may not have thought of before.

An example is the LabVIEW development environment.  LabVIEW is a software platform made by National Instruments, used widely in industry for test and measurement applications.  Recently, Enthought released the Python Integration Toolkit, which is a “bridge” between the LabVIEW and Python environments.  

So not only can you call Python code from LabVIEW, you can access the greater universe of Python software, including routines for signal processing, machine learning, and cloud-connected visualization like Plotly. Here’s a 2-minute introduction to the Toolkit from Eric Jones, Enthought’s CEO, speaking at National Instruments’ 2016 NI Week conference:

By writing a minimal Python “glue” module, you can call the Plotly API from LabVIEW and instantly share data to the cloud.  Here’s an example LabVIEW program and the Python code which powers it.  By the way, this example and others are included along with every copy of the Toolkit, so you can get started right away:

LabVIEW demo VI

And the code it calls, which is basically “Hello World” for Plotly:

Combining Plotly.js with Python lets you build even more sophisticated apps.  For example, you can run a Python web server alongside the LabVIEW environment, and stream data to it live.  Here’s the LabVIEW end of things, acquiring data from a simulated instrument:

Web Dashboard VI

And the Plotly dashboard, running in a local process, accessed by a web browser:

labview_web_dash

You can download the Python Integration Toolkit here to try using Plotly, Python, and LabVIEW together with your own data.

Finally, see a live demo of using Plotly as a web dashboard for LabVIEW and other examples of how Python can extend LabVIEW’s capabilities at a webinar, Thursday August 25, 2016 (1 PM CT) or Wednesday, August 31, 2016 (9 AM CT). Sign up to attend or to get a recording of a session here

Andrew Collette

Andrew is a scientific software developer at Enthought, and lead developer of the Python Integration Toolkit for LabVIEW.