cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
rcast15
Level III

Change Transparency of Area with JSL

Hi,

I am fitting a model by a grouping variable and saving the prediction and interval formulas to my table. I then am putting the original Y, predicted Y, and LCL/UCL on my Y axis and creating a plot with the grouping variable in the Wrap functionality (see code below for an example).

What I want is to be able to set the transparency of my Area to a specific number thru scripting. I know I can right click in the legend and change it that way, however this is for a script which takes user input so I cannot use the regular Send to Report and Dispatch where I call out the columns in a static manner.


Names Default To Here( 1 ); dt = Open( "$SAMPLE_DATA/Diamonds Data.jmp" ); mod = Fit Model( Y( :Price ), By( :Color ), Effects( :Depth ), Personality( "Standard Least Squares" ), Emphasis( "Effect Screening" ), Run( :Price << {Summary of Fit( 0 ), Analysis of Variance( 0 ), Parameter Estimates( 1 ), Sorted Estimates( 0 ), Plot Actual by Predicted( 1 ), Plot Regression( 0 ), Plot Residual by Predicted( 1 )} ) ); mod << prediction and interval formulas; Graph Builder( Size( 1163, 748 ), Show Control Panel( 0 ), Show Legend( 0 ), Variables( X( :Depth ), Y( :Price ), Y( :Pred Formula Price By Color, Position( 1 ) ), Y( :Lower 95% Mean Price By Color, Position( 1 ) ), Y( :Upper 95% Mean Price By Color, Position( 1 ) ), Wrap( :Color ), Overlay( :Color ) ), Elements( Points( X, Y( 1 ), Legend( 7 ) ), Line( X, Y( 2 ), Legend( 9 ) ), Area( X, Y( 3 ), Y( 4 ), Legend( 10 ), Area Style( "Range" ), Transparency(0.25) ) ) );
1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: Change Transparency of Area with JSL

You can look for PolySegs and then set their Transparency

Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Diamonds Data.jmp");


mod = dt << Fit Model(
	Y(:Price),
	By(:Color),
	Effects(:Depth),
	Personality("Standard Least Squares"),
	Emphasis("Effect Screening"),
	Run(
		:Price << {Summary of Fit(0), Analysis of Variance(0), Parameter Estimates(1),
		Sorted Estimates(0), Plot Actual by Predicted(1), Plot Regression(0),
		Plot Residual by Predicted(1)}
	)
);

mod << prediction and interval formulas;

gb = dt << Graph Builder(
	Size(1163, 748),
	Show Control Panel(0),
	Show Legend(0),
	Variables(
		X(:Depth),
		Y(:Price),
		Y(:Pred Formula Price By Color, Position(1)),
		Y(:Lower 95% Mean Price By Color, Position(1)),
		Y(:Upper 95% Mean Price By Color, Position(1)),
		Wrap(:Color),
		Overlay(:Color)
	),
	Elements(
		Points(X, Y(1), Legend(7)),
		Line(X, Y(2), Legend(9)),
		Area(X, Y(3), Y(4), Legend(10), Area Style("Range"))
	)
);

fbs = Report(gb) << XPath("//FrameBox");
For Each({fb}, fbs,
	ps = fb << Find Seg(PolySeg(1));
	If(!IsEmpty(ps),
		ps << Transparency(0.25);
	);
);
-Jarmo

View solution in original post

1 REPLY 1
jthi
Super User

Re: Change Transparency of Area with JSL

You can look for PolySegs and then set their Transparency

Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Diamonds Data.jmp");


mod = dt << Fit Model(
	Y(:Price),
	By(:Color),
	Effects(:Depth),
	Personality("Standard Least Squares"),
	Emphasis("Effect Screening"),
	Run(
		:Price << {Summary of Fit(0), Analysis of Variance(0), Parameter Estimates(1),
		Sorted Estimates(0), Plot Actual by Predicted(1), Plot Regression(0),
		Plot Residual by Predicted(1)}
	)
);

mod << prediction and interval formulas;

gb = dt << Graph Builder(
	Size(1163, 748),
	Show Control Panel(0),
	Show Legend(0),
	Variables(
		X(:Depth),
		Y(:Price),
		Y(:Pred Formula Price By Color, Position(1)),
		Y(:Lower 95% Mean Price By Color, Position(1)),
		Y(:Upper 95% Mean Price By Color, Position(1)),
		Wrap(:Color),
		Overlay(:Color)
	),
	Elements(
		Points(X, Y(1), Legend(7)),
		Line(X, Y(2), Legend(9)),
		Area(X, Y(3), Y(4), Legend(10), Area Style("Range"))
	)
);

fbs = Report(gb) << XPath("//FrameBox");
For Each({fb}, fbs,
	ps = fb << Find Seg(PolySeg(1));
	If(!IsEmpty(ps),
		ps << Transparency(0.25);
	);
);
-Jarmo

Recommended Articles