| Getting Started | Documentation | Glish | Learn More | Programming | Contact Us |
| Version 1.9 Build 803 |
|
The following example shows how several plots can be drawn to individual panels on a single page. It also illustrates a simple method of plotting an image (represented as a simple Glish array) to the PGplotter window.
#
# Create some data to plot:
#
x1 := 1:100; y1 := (x1/10)^2
x2 := 1:50; y2 := log(x2)
x3 := -1000:1000
y3 := sin(x3/100)*cos(x3/100)
im := array(0,100,100)
for (i in 1:100)
for (j in 1:100)
{
im[i,j] := i/50+sin(j/10)+random(0,10)/10
}
#
# and plot the 4-panels:
#
include 'pgplotter.g'
pg := pgplotter()
pg.subp(2,2)
pg.env(min(x1),max(x1),min(y1),max(y1),1,0)
pg.line(x1,y1)
pg.env(min(x2),max(x2),min(y2),max(y2),0,0)
pg.line(x2,y2)
pg.env(min(x3),max(x3),min(y3),max(y3),0,0)
pg.line(x3,y3)
pg.env(1,100,1,100,1,0)
pg.gray(im,-1,4,[0,1,0,0,0,1])