Example Code

Multiple Plots and Scales on One Graph Using LabVIEW

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Download All

Overview

This example shows a quick way to be able to plot 2 signals on a graph and have their respective scales on different sides.


Description
This VI shows 2 signals on the same graph with their own respective scales. It looks like 1 graph but it is actually 1 graph on top of another. The Cos graph was created separately and the Tools Palette was used to make everything transparent other than the signal itself and the scale.

 


Requirements

  • LabVIEW 2012 (or compatible)


Steps to Implement or Execute Code

  • Select the device sine and cos amplitude.
  • Run the program

 

Additional Information or References
Front Panel

3-334.png

**This document has been updated to meet the current required format for the NI Code Exchange.**

Kind Regards

Michael
NIUK Application Engineer

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
D*
Member
Member
on

An alternate way to do this natively in LabVIEW is to add another y-axis scale.  To do this:

1. Right click the existing y-axis scale and choose "Duplicate scale".

2. Typically, I like to have the scales on different sides of the graph as you have shown. So the next step is to right click one of the y scales and select "Swap sides".

3. Now you need to register each plot with the appropriate scale.  Right click the plot in the plot legend, and select "Y scale" at the bottom which will open a menu to the y-axes that you have created.

The nice part about doing this natively in the graph, is that both graphs will continue to share the same x-axis and all of the graph tools work as expected.

sanjeeev
Member
Member
on

well, it would be really nice if you could detail how you actually got those 2 plots ( cos and sine ) on the same graph. you have just mentioned you made one transparent using the tools palette . but how>?

Thank You

ragu_C
Member
Member
on

Hi,

Do you have any idea about duplicate Y scale by programmatically?

Thank you