I have some data which I would like to plot on a chart but I would also like to plot the middle section of the data in a different colour. Imagine a bell curve where the middle peak is to be a different colour so the outlier sections.
What i have done so far is to get the two regions into different arrays, now I need to combine them into the same array to plot together. However I don't know how I sync them. At the moment when I plot them the middle section is plotted from index 0 on the x axis when it needs to be shifted by an offset. I have thought about placing it into the correct index however this will result in the ends being plotted as zeroes which is unwanted.
Common pitfall: rigth click on the graph and disable 'ignore timestamp'
convert all datapoints to xy data and plot it with a xy-graph or a mixed-graph
more help if you attach your example vi with example data 🙂
Hi , thanks for your help. Unfortunately the data doesn't have a timestamp. the frequency is know and that what I'm using to plot. I'm not using the absolute time just relative time - the date was captured at 1000hz.
As for the xy graph solution, how would i go about creating a coloum of integers for the x axis.
The "trick" to plotting a set of data using different colors for different sets of points is to realize that (a) you can't do it in LabVIEW, as a plot has a "defined color" for the entire set of points, so (b) you need to "cheat" a little and plot it twice.
Let's assume you have an array "Red Data" of Dbls (you need to use Floats for this, so if your data are integers, you'll need to copy them to a Dbl array. Make a copy of Red Data, call it Green Data. Now set Red Data to plot using Red points, and Green Data to plot using Green Points. If you plot them both, the points will sit "on top of" each other, and whichever is plotted last will show up, not what you want.
So now you need to "disappear" the Red Data points that should be Green, and the Green Data Points that should be Red. Make a third, Boolean, array called "Red", and set it True if you want a Red point, and False if you want a Green point. Now, in a For loop, process all three Arrays. If Red is True, set the Green Data point to NaN (Not a Number) and the Red Data point to itself (i.e. "preserve it), while if Red is False, set the Red Data point to NaN and Green Data to itself. Now plot both Red Data and Green Data. The NaN data points don't plot, so each position gets either a Red Data or Green Data point, as you specify.
One annoying part of two plots with NaN is the gap you have if you just sort the points to 2 colors (see top graph)
so I would suggest easy mod to just add colored points , see the lower solution.
or share one point in both plots.... or simply overlay ( play with the plot properties)
How many ideas have already been posted to motivate NI to have a graph with a color ramp plot?
Thank you all for the suggestions. Creating two arrays and then bundling into a waveforem cluster seems to work the best.