LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

2 plots in 1 graph

I want to put 2 plots in 1 graph, but why doesnt this work, and how do i fix this?

corned_0-1729586466352.png

 

0 Kudos
Message 1 of 11
(307 Views)

Hi corned,

 


@corned wrote:

why doesnt this work


The "why" is explained in the context help window when you move the mouse pointer over the broken wire… (Basic LabVIEW knowledge!)

 


@corned wrote:

how do i fix this?


By using the correct function to build an array of plots.

(Right now you create a cluster of plots. Did you read the context help for the XY graph? There are also example VIs in the example finder that explain how to create plots in graphs!)

 

On your VI image:

  • Why do you use a shift register to create a counter when there is a "i" terminal in each FOR loop?
  • Why do you add the offset in one loop and multiply in the other loop?
  • Why do you need two loops when both run the same (fixed) number of iterations?
Best regards,
GerdW


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

@GerdW wrote:
  • Why do you use a shift register to create a counter when there is a "i" terminal in each FOR loop?
  • Why do you add the offset in one loop and multiply in the other loop?
  • Why do you need two loops when both run the same (fixed) number of iterations?

also:

  • Why are your controls inside the loop? Do you expect to change them while the loop is running? If they should not change between iterations, the terminals belong before the loop so the compiler can treat them as constants during the loop. Much less overhead.
  • why do you think you need any express VIs and dynamic data for this?
0 Kudos
Message 3 of 11
(263 Views)

In order to combine your 2 graphs into 1, you need to use the function build an array

LVNinja_1-1729625371533.png

 

 

Message 4 of 11
(253 Views)

Hello, first of all, if my vi pains you, im sorry im kinda new to labview.

 

I am making a vi where i can plot multiple f=ax+b graphs in 1 display. Starting with 2 of course. I also want the lines to be like infinitely long like a linear graph should be. Now i have tried a couple of things but this is where im stuck, can anyone help me? Thanks a lot 🙂

corned_0-1730797093667.png

 

0 Kudos
Message 5 of 11
(224 Views)

I believe the word for what i want to do in english is regression? Also if it is not possible to make the lines infinitly long it doesn't really matter but would be nice.

0 Kudos
Message 6 of 11
(222 Views)

No need to make them infinitely long, just longer than your graph domain:

 

Basjong53_2-1730798651581.pngBasjong53_0-1730798717946.png

 

 

If you want multiple XY graphs, make a and b an array and place a for loop

Basjong53_1-1730798626224.pngBasjong53_1-1730798751703.png

 

 

 

0 Kudos
Message 7 of 11
(199 Views)

Hi corned,

 

please keep related questions in the same thread…

 


@corned wrote:

I am making a vi where i can plot multiple f=ax+b graphs in 1 display. Starting with 2 of course. I also want the lines to be like infinitely long like a linear graph should be.


We already discussed the "infinitely long lines", so why insist on this?

 

  • Why do you use an XY graph in favor of a waveform graph?
  • Why do you create a single XY plot of your two "best fit" results instead of showing two plots on your graph?

@corned wrote:

Now i have tried a couple of things but this is where im stuck, can anyone help me?


Help with what? What exactly are you trying to solve?

 

It's nice to attach real code, but wouldbe even nicer when you would downconvert to some older LabVIEW versions before attaching. (I prefer LV2019, most are happy with LV2021 or older.)

Use File->"Save for previous"!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 11
(193 Views)

How did you make your graph look so clean?

 

0 Kudos
Message 9 of 11
(188 Views)

@corned  ha scritto:

How did you make your graph look so clean?

 


It's just the default XY Graph (NXG style) with autoscaling turned off. I only added a cursor at (0,0).

Message 10 of 11
(180 Views)