LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to plot with multi colors in a single XY graph?

Solved!
Go to solution

Hi,

  I'm making hesteresis measurements. In this case, I collect data while sweeping voltage first from 0 to 2V, and then back from 2V to 0V, and the data are plotted in a single XY graph. In the XY graph, I want forward sweep plot of one color while the reverse sweep with another color so I can easily make comparisons. And I want to see the data real time. I tried to wire "plot color" in "property node", but this will change the color globally and can not be applied to a section of data. Can anyone advise me how to do this? Thanks!

 

Guanglei 

0 Kudos
Message 1 of 8
(3,640 Views)

A simple yet slightly inefficient way of ding this might be to split you array of data into two arrays. One for the up sweep and one for the down. Each array should have for example 10 points and then 10 zero's (or play with the time base) and repeat. The other would be 180 degrees out of phase and so the effect would be a sigle line. Each line could then be handled separatly.

 

This would only work if your sweep was known uniform and repetative, if it is not known initialy you could do a bit of pre processing, the differential would show you the gradient and therefore direction of sweep for example. This is getting complicated though, there must be a better way. can you attach (the vi) or a screen shot of the graph you have at the moment to get a better understanding

 

best regards

Graham Green

Sr. Product Marketing Manager

National instruments
0 Kudos
Message 2 of 8
(3,635 Views)

Hi Guanglei,

you can create different plots from your data and change the color of these plots. Then you have what you need.

 

Mike

0 Kudos
Message 3 of 8
(3,634 Views)

Hi Graham,

  Thank you very much for the reply, I really appreciate it.

  However I don't quite understand your descripton. Yes I do spit my data in two arrays, one for forward sweep, and the other for reverse sweep. I can plot with different colors in XY graph by appending several XY graphs into one, but by doing this I can not see the data real time. I quickly made a vi to demonstrate my problem,  hope this will give you a better understanding. Thanks. 

 

Guanglei

0 Kudos
Message 4 of 8
(3,624 Views)

Hi Mike,

  Thanks for the reply. However I have to use single XY plot and see data in real time. I've attached a demo vi showing my problem in post #4. 

 

Guanglei

0 Kudos
Message 5 of 8
(3,618 Views)
Hi Guanglei  Without creating your own plot indicator you can't get a single trace to show as more than one colour. As Graham says, you need two plots and check the direction using the differential. If your signal isn't too noisy you can do this in real time otherwise you might have to filter to find the up/down direction. Take a look at the vi, it might help you. 

Ian

0 Kudos
Message 6 of 8
(3,606 Views)
Solution
Accepted by topic author Spiral

Hi Guanglei,

please see the attached example.

 

Hope it helps.

Mike

Message 7 of 8
(3,603 Views)

Tanks Mike and LanW, they both works for me!!

 

Guanglei 

0 Kudos
Message 8 of 8
(3,568 Views)