cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
LGaspard_98
Level I

Plot multiple Y axis from a list of column on JSL

Hi all, 

 

I have an issue with plotting some data from an FTIR experiment. I have a list containing the name of the columns I want to plot on the Y axis so that they are all overlaid on the same scale (not on top of each other). But somehow I can't figure out how to write the code. 


I tried like this but it seems like the "Position([1])"isn't really working.

 

Can anyone help?

 

Thanks!

gb = dt<< Graph Builder(
    Show Control Panel(1),
    Variables(X(:Wavenumber)),
    Elements( Line(X,Y))
);
   
gb << inval;
 
For Each({y_col, idx}, columns_list,
	Eval(evalExpr(
		gb << Add Variable({Expr(Name Expr(As Column(dt, y_col))),Position([1]), Role("Y")})
	));
);
gb << Update window;
1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: Plot multiple Y axis from a list of column on JSL

Have you compared how the script would look if Graph Builder built it? There is a small mistake in your code

Graph Builder(
	Variables(
		X(:SITE),
		Y(:NPN1),
		Y(:PNP1, Position(1)),
		Y(:PNP2, Position(1)),
		Y(:NPN2, Position(1))
	),
	Elements(Line(X, Y(1), Y(2), Y(3), Y(4), Legend(4)))
);

Notice how Position is used (you have extra []. You also had missing "," which I fixed when I added JSL formatting to your code so I could use JSL reformat easier).

Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Semiconductor Capability.jmp");

gb = dt<< Graph Builder(
    Show Control Panel(1),
    Variables(X(:Site)),
    Elements(Line(X,Y))
);   

columns_list = {"NPN1", "PNP1", "PNP2", "NPN2"};

For Each({y_col, idx}, columns_list,
	Eval(evalExpr(
		gb << Add Variable({Expr(Name Expr(As Column(dt, y_col))), Position(1), Role("Y")})
	));
);

jthi_0-1729138840778.png

 

-Jarmo

View solution in original post

2 REPLIES 2
jthi
Super User

Re: Plot multiple Y axis from a list of column on JSL

Have you compared how the script would look if Graph Builder built it? There is a small mistake in your code

Graph Builder(
	Variables(
		X(:SITE),
		Y(:NPN1),
		Y(:PNP1, Position(1)),
		Y(:PNP2, Position(1)),
		Y(:NPN2, Position(1))
	),
	Elements(Line(X, Y(1), Y(2), Y(3), Y(4), Legend(4)))
);

Notice how Position is used (you have extra []. You also had missing "," which I fixed when I added JSL formatting to your code so I could use JSL reformat easier).

Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Semiconductor Capability.jmp");

gb = dt<< Graph Builder(
    Show Control Panel(1),
    Variables(X(:Site)),
    Elements(Line(X,Y))
);   

columns_list = {"NPN1", "PNP1", "PNP2", "NPN2"};

For Each({y_col, idx}, columns_list,
	Eval(evalExpr(
		gb << Add Variable({Expr(Name Expr(As Column(dt, y_col))), Position(1), Role("Y")})
	));
);

jthi_0-1729138840778.png

 

-Jarmo
LGaspard_98
Level I

Re: Plot multiple Y axis from a list of column on JSL

Hi jthi!

Indeed the only issue was with the [ ]... Thank you for spotting this!

 

Best,

Louis