Draw line or polygon with respect to second Y axisHi everybody,
my plot has two y axis. What I would like to do in a script is to draw lines and polygones.
I can draw with respect to the first y axis e.g. by
Polygon( [0,1,2], [1, 1, 3] );
How do I tell JMP that I mean [1, 1, 3] with respect to the second y axis? Can I switch between axis somehow just like the color or line style?
Thanks!
Re: Draw line or polygon with respect to second Y axisHere is a simple example
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/semiconductor capability.jmp" );
gb = Graph Builder(
Variables( X( :PNP2 ), Y( :NPN1 ), Y( :PNP1, Position( 1 ), Side( "Right" ) ) ),
Elements( Points( X, Y( 1 ), Legend( 5 ) ), Points( X, Y( 2 ), Legend( 7 ) ) ),
SendToReport(
Dispatch(
{},
"PNP1",
ScaleBox,
{Format( "Best", 10 ), Min( 100 ), Max( 540.816326530612 ), Inc( 50 ), Minor Ticks( 1 )}
)
)
);
NPN1y1 = 110;
NPN1y2 = 122;
PNP1y1 = 300; // Right side reference
x1 = 150;
x2 = 250;
x3 = 600;
Report( gb )[framebox( 1 )] << Add Graphics script(
leftMin = Report( gb )[AxisBox( 2 )] << get min;
leftMax = Report( gb )[AxisBox( 2 )] << get max;
rightMin = Report( gb )[AxisBox( 3 )] << get min;
rightMax = Report( gb )[AxisBox( 3 )] << get max;
xMat = Matrix( x1 ) || Matrix( x2 ) || Matrix( x3 );
// Calculate a left axis reference based upon right axix value
newMatY = leftMin + (leftMax - leftMin) * (PNP1y1 - rightMin) / (rightMax - rightMin);
yMat = Matrix( NPN1y1 ) || Matrix( NPN1y2 ) || Matrix( NewMatY );
Transparency( 0.5 );
Fill Color( {1.0, 0.5, 0.0} );
Polygon( xmat, yMat );
);Re: Draw line or polygon with respect to second Y axisOh, so you mean something like
Y value second axis --> Get pixel position in plot window / on screen --> Calculate Y value on first axis with same pixel position?
Do you have an example for me?Re: Draw line or polygon with respect to second Y axisI was not implying to do it manually. I was implying that one does have programatic access to both axes, which would allow one to calculate the Y axis position.
Re: Draw line or polygon with respect to second Y axisOf course you can always do it manually by transforming coordinates. But things get more complicated when you have at least one nonlinear y axis. I was hoping there is a faster option.
Thanks anyway for confirming there is none. 
Re: Draw line or polygon with respect to second Y axisI don't see an axis switch, however, you can always get the min and max for the different axis boxes and then interprolate between the 2 scales