LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

X-Y plot with different colours

Solved!
Go to solution

Dear all,

 

I wanted to plot the x-axis (time details) against yaxis (data). I cant seem to be able to plot them to X-Y graph.

 

My intention is to split the data into time and data then do some sorting work to plot my graphs. I have attached the data. I have successfully split the data into 2 parts.

 

Is it possible to plot with different colours for the measurement data range while keeping the timestamp?

 

Meaning 80 and above      - one colour (Blue)

                40  to 50 range - one colour   (Green)

                10 to 30 range   - one colour  (Red)

 

All should be plotted on the same graph eventually.  I think only X-Y graph can do that right?

 

 

 

 

Download All
0 Kudos
Message 1 of 12
(4,663 Views)

Hi Joven,

 

in a graph each plot can have just one color.

Conclusion: when you need to plot with different colors you need to use more than one plot in the graph!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 12
(4,647 Views)

This the correct VI.

Download All
0 Kudos
Message 3 of 12
(4,642 Views)

Dear Sir,

 

Yes that what i think.

 

But i am thinking of splitting or sorting the data into various threshold and to split them into different clusters before mapping them again into a x-Y plot. It is like entering different datasets (with each dataset, an assigned colour) and finally plotting on the X-Y together.

 

 

 

 

0 Kudos
Message 4 of 12
(4,639 Views)

An example of the plot will be as attached.

 

I intend to split the whole data into multiple sections and treat them as different datasets and plot them on the same graph. The criteria of splitting is based on the range of the data values.that it falls in.

 

i think superimpose all the plots into one graph is one solution but not sure is it efficient for large datasets. There is also one problem i faced as one of the column is a timestamp data and i not sure how to plot them on a graph.

 

Thank you!

0 Kudos
Message 5 of 12
(4,636 Views)

Hi Joven,

 

most of your stuff can be done much simpler:

check.png

Now you need to convert the strings to numbers/timestamps, sort them according to your requirements and build plots from the sorted results. Then display your array of plots in your XY graph…

 

That's a nice task to learn several basic LabVIEW concepts like loops, autoindexing, conditions, clusters (for XY plots)!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 12
(4,634 Views)

 

Dear Sir,

 

Thanks for the advise. It helps greatly.

 

If let say i want to sort the data (in column 1) , but still want to remember the sorting sequence and apply to column 0. What are the various ways to do them efficiently?

 

Thank you!

0 Kudos
Message 7 of 12
(4,620 Views)

Dear Sir,

 

I have figured out and sorted the array already. Will try the plotting of the graph using x-y graph.

 

Thank you!

0 Kudos
Message 8 of 12
(4,616 Views)

Dear gerdw,

 

I have sort and split the datasets into 3 parts. I hope to plot them each with different colours on the same plot.

 

However the 1st column is a string with date time details and the other column is numerical value. What should I do to plot them out on a graph showing both time date details (x axis) and data (y axis) What graph should I use?

 

Thank you.

 

 

0 Kudos
Message 9 of 12
(4,600 Views)

Hi Joven,

 

as said before: you need to convert your array of strings to an array of timestamps!

All you need is a FOR loop with a ScanFromString inside…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 12
(4,590 Views)