07-13-2015 03:16 PM - edited 07-13-2015 03:21 PM
Hi all,
relatively new to labview, and finding the plotting aspect very difficult to get my head around.
I have three 1D arrays:
X: 1D array of x values (double) - called Axis in the VI
Y1: 1D array of y values (int32) - called Histogram in the VI
Y2: 1D array of y values (double) - called Gaussian Fit in the VI
The y arrays both correspond 1-1 with the x array. I want to plot them on the same plot, with Y1 as a column plot and Y2 as a line plot. Can someone point me in the right direction? Specifically I need to know what chart type to use, and how to combine the three arrays into clusters or something that the plot type can recognize.
Let me know if more information is needed. I have also attached my code so far, as well as a sample data set. Basically I want to comine the two plots into one. When you run it it will ask for a file - feed it the .csv file and enter "1" in the dialogue box when it asks how many header lines there are.
Thanks!
Solved! Go to Solution.
07-13-2015 03:33 PM - edited 07-13-2015 03:36 PM
Step 1: get rid of the sequence structure and local variables and hidden controls/indicators. None are needed.
Step 2: Have a look at the top picture here on how to graph xy plots that share a common x axis.
07-13-2015
03:34 PM
- last edited on
06-06-2025
04:31 PM
by
Content Cleaner
Here's an example / tutorial.
Edit: Altenbach beat me again!
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'
07-13-2015 03:57 PM - edited 07-13-2015 04:00 PM
What is he VI he is using to combine the arrays?
Never mind, got it - it just looked different on the pallete
07-13-2015 03:58 PM
Build Array...
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'
07-13-2015 04:44 PM - edited 07-13-2015 04:44 PM
@altenbach wrote:
Step 1: get rid of the sequence structure and local variables and hidden controls/indicators. None are needed.
Here's how the code could look like without the sequence structure, without the locals, without all the hidden indicators, and some of the Rube Goldberg code streamlined. THere are significqantly more simplifications possible, this is just a literal rewrite, all flow is the same. If you used the hidden indicators as crutches to remind you of the data name, use wire labels instead. The wire is the data!
altenbach wrote:Step 2: Have a look at the top picture here on how to graph xy plots that share a common x axis.
Of course xy graphs accept a large variety of datatypes (array of xy point clusters, cluster of xy arrays, 1D complex arrays, cluster arrays of complex arrays, etc.), and creating multiple plots differs somewhat depending on datatype.
07-13-2015 06:01 PM
07-13-2015 06:10 PM
You can easily leave the same indicators connected to the wire for troubleshooting, there is still no need for local variables.
For direct open-brain surgery troubleshooting while the VI is running, just use probes. 😄
07-13-2015 06:33 PM - edited 07-13-2015 06:38 PM
I guess I understand the point being made in the .png above, but is it not more readable with the flat sequence structure? I'm learning so I'm sure there are good reasons for doing it like that, but what are they? It seems like you are sacrificing readability for streamlining the dataflow, but when the program run in <1s regardless does it matter much?
EDIT: I'm not referring to the rube goldberg cleanup - obviously I have a lot to learn manipulating arrays through loops and I am making my life more difficult than it could be. I just mean the reduction in modularity in general.
07-13-2015 07:14 PM