Community Trekker

Joined:

Jan 6, 2016

## Plotting Multiple Data Series Using Graph Builder

Hi all,

I have a feel this isn't possible, but I thought I would ask anyway.  I would like to add different XY data sets to a graph.  The problem is that series aren't sharing the same x values.  What I am trying to do is plot swept data for many transistors and not all of the data has the same number of steps in the sweep.

If Column 1 and Column 2 are my first X and Y values, respectively, and Column 3 and 4 are my second set of X and Y values, respectively.  When I add them to the Graph Builder, instead of getting two plots, I get four.  Column 2 with Column 1, Column 2 with Column 3, Column 4 with Column 1 and Column 4 with Column 3.  I see I have I can remove those from the plot by changing the transparency.  However, I will be doing with with a lot of data and it wouldn't be practical at all to do it manually.  Is there a way to do this with JSL?

Thanks, Natalie

1 ACCEPTED SOLUTION

Accepted Solutions

Super User

Joined:

Mar 20, 2012

Solution

## Re: Plotting Multiple Data Series Using Graph Builder

Actually, as Jim mentioned, this is exactly the stack that's being performed.

``````Data Table( "Table" ) << Stack(
columns( :X1, :Y1, :X2, :Y2 ),
Source Label Column( "Label" ),
Stacked Data Column( "Data" ),
Number of Series( 2 )
);``````

As for the Graph Builder, rearranging the parameters produces this:

``````Graph Builder(
Show Control Panel( 0 ),
Variables( X( :Data ), Y( :Data 2 ), Overlay( :Label 2 ) ),
Elements( Points( X, Y), Smoother( X, Y ) )
);``````

Of course you would have to relabel the "Data" (X1&X2) and "Data2" (Y1&Y2) columns accordingly..

PDB
5 REPLIES

Super User

Joined:

Mar 20, 2012

## Re: Plotting Multiple Data Series Using Graph Builder

If I'm understanding you correctly, I think if you can stack the data and introduce a grouping variable then you can use that variable as GROUP X in Graph Builder.

Does this look like what you'd want? I can provide more details on the stacking if this is the right direction.

PDB

Community Trekker

Joined:

Jan 6, 2016

## Re: Plotting Multiple Data Series Using Graph Builder

Hi Philip,

Thanks for getting back to me!  That isn't quite what I had in mind, though.  I took a screenshot of what I am looking for.  This is an example using two sets of data but actually there will be over 100.  Is there an easy way to do this for large sample sizes without manually changing the transparency of the curves?

Highlighted

Super User

Joined:

Jun 22, 2012

## Re: Plotting Multiple Data Series Using Graph Builder

Natalie,

I think the solution is to stack your data, as Philip suggested, but you need to do a 2 column stack, where you stack all of your Y columns and all of your X columns.  Then you can run the Graph Builder, and specify the "Label" column that is created in the stacking process, as the Overlay column in the Graph Builder.  It will give you a separate line/curve for each level of "Label"(pair of X and Ys).

Jim

Super User

Joined:

Mar 20, 2012

Solution

## Re: Plotting Multiple Data Series Using Graph Builder

Actually, as Jim mentioned, this is exactly the stack that's being performed.

``````Data Table( "Table" ) << Stack(
columns( :X1, :Y1, :X2, :Y2 ),
Source Label Column( "Label" ),
Stacked Data Column( "Data" ),
Number of Series( 2 )
);``````

As for the Graph Builder, rearranging the parameters produces this:

``````Graph Builder(
Show Control Panel( 0 ),
Variables( X( :Data ), Y( :Data 2 ), Overlay( :Label 2 ) ),
Elements( Points( X, Y), Smoother( X, Y ) )
);``````

Of course you would have to relabel the "Data" (X1&X2) and "Data2" (Y1&Y2) columns accordingly..

PDB

Super User

Joined:

Mar 20, 2012

## Re: Plotting Multiple Data Series Using Graph Builder

Here's a further example with more series.

In general, the stack becomes:

``````Data Table( "StackedTable" ) << Stack(
columns(
:age,           // X1
:ratio,       // Y1
:age 1,          // X2
:Predicted ratio,              // Y2
:age 2,                      // X3
:Predicted ratio 2,            // Y3
:age 3,      // X4
:Predicted ratio 3,            // Y4
:age 4,      // X5
:Spline Predictor for ratio       // Y5
),
Source Label Column( "Label" ),
Stacked Data Column( "Data" ),
Number of Series( 2 )

)``````

PDB