= #JxnPortable\docs\plot_examples\PlotFrameDemo.jxn

owner = @Frame( "PlotFrameDemo" )
#JXN:include/SliderInclude  ! arranges slider and PlotFrame windows in a common Frame window
owner.setFont( @java.awt.Font( "Dialog", Font.BOLD, 16 ) )
#JXN:include/P3dInclude  ! returns p3d for 3D-displays
phi = p3d_phi
!
!
! graphs depending on one single variable x or t
!
! 1a: x -> y
y_1a = sin( 0.2 PI x + toRadians(phi) )
pf1a = plot( x, y_1a ).setXYLabels( "x", "y = f(x)" )
!
! 1b: t -> x, y
x_1b = exp -4 t * cos( 10 PI t - toRadians phi )
y_1b = exp -4 t * sin( 10 PI t - toRadians phi )
pf1b = plot( x_1b, y_1b ).setXYLabels( "x", "y" ).setHeadline( "x = f(t);   y = g(t)" )
!
! 1c: t -> x, y, z
x_1c = sqrt 1.25 t * cos 10 PI t
y_1c = sqrt 1.25 t * sin 10 PI t
Z_1c = 1.25 t
pf1c = plot( p3d ).add( x_1c, y_1c, Z_1c )
pf1c.setAutoScale(0).setHeadline( "x = f(t);   y = g(t);   z = h(t)" )
!
!
! graphs depending on two variables u and v
!
! 2a: x, y -> z
uv2a = @JxnUVGrid( -2.5, 2.5, 0.25, -2.5, 2.5, 0.25, -2 )
x_2a = uv2a.u()
y_2a = uv2a.v()
! z_2a = max( h0 - x_2a^2 - 4 y_2a^2, 0 )
z_2a = ( x_2a^2 + 2.5 y_2a^2 - y_2a ) * exp( 1 - x_2a^2 - y_2a^2 )
pf2a = plot( p3d ).add( x_2a, y_2a, z_2a )
pf2a.setAutoScale(0).setHeadline( "z = f(x,y)" )
!
! 2b: u, v -> x, y
uv2b = @JxnUVGrid( 0., 360., 30., 0., 1.0, 0.2, -5 )
x_2b = uv2b.v() cosD( uv2b.u() + phi )
y_2b = uv2b.v() sinD( uv2b.u() + phi )
pf2b = plot( x_2b, y_2b, 1. ).setXYLabels( "x", "y" ).setHeadline( "x = f(u,v);   y = g(u,v)" )
!
! 2c: u, v -> x, y, z
uv2c = @JxnUVGrid( -90., 90., 30., -210., 210., 30., 10 )
lat = uv2c.u()
lon = clip( uv2c.v(), -180., 180. )
x_2c = cosD lat * cosD lon
y_2c = cosD lat * sinD lon
z_2c = sinD lat
zv2c = sw( getZ( p3d, { x_2c, y_2c, z_2c } ), Double.NaN + z_2c, z_2c )  ! visible -> solid line
zh2c = sw( getZ( p3d, { x_2c, y_2c, z_2c } ), z_2c, Double.NaN + z_2c )  ! hidden -> broken line
pf2c = plot( p3d ).add( x_2c, y_2c, zv2c ).add( x_2c, y_2c, zh2c, R, -1 )
pf2c.setHeadline( "x = f(u,v);   y = g(u,v);   z = h(u,v)" )
!
!
grid15 = @Panel()  ! 6 PlotFrame are merged into one common Frame together with the slider and slider variable fields.
#JXN:include/Grid15Include.jxn( pf1a, pf1b, pf1c, pf2a, pf2b, pf2c )
owner.add( grid15, java.awt.BorderLayout.CENTER )
slider.getSliderFrame().hide()
#JXN:include/FrameInclude.jxn