Vous trouverez ici une description de toutes les sous-routines de GrWin.
Vous pouvez sinon consulter le site de la librairie.
L'installation de GrWin est nécessaire pour utiliser PGPLOT avec le GFORTRAN. Vous pouvez ainsi consulter ces instructions si vous voulez installer GrWin chez vous.
Vous trouverez ici les instructions spécifiques à Windows 10.
gfortran Exemple.f90 -o Exemple.exe -I%GWMODDIR% -Wl,--subsystem,console -lpgplot -lGrWin -mwindows
Il est plus simple de mettre tout cela dans un Makefile et de faire
make
Program Main
implicit none
integer,parameter :: r = 4 ! simple précision
real(kind=r) :: xmin, xmax, ymin, ymax, x1, y1, x2, y2, pxlx, pxly, U1, V1, U2, V2
integer :: i, res, resx, resy, IRTN, NW
xmin = -3.14_r ; xmax = 3.14_r ; ymin = -1.1_r ; ymax = 1.1_r
NW = 1 ! windows number
call GWOPENX(IRTN,NW,0,0,19,0,10,'') ! open graphics window
call GWINDOW(IRTN,xmin,ymin,xmax,ymax) ! define world coordinates
call GWSIZE(IRTN,1,resx,resy) ! get numbers of pixels
call GWPXLSIZ(IRTN,pxlx,pxly) ! get pixel size
call GWLINE(IRTN,xmin,0._r,xmax,0._r) ! draw x axis
call GWLINE(IRTN,xmax,0._r,xmax-8*pxlx, 8*pxly)
call GWLINE(IRTN,xmax,0._r,xmax-8*pxlx,-8*pxly)
do i = ceiling(xmin), floor(xmax)
call GWLINE(IRTN,i*1._r,-5*pxly,i*1._r,5*pxly)
enddo
call GWLINE(IRTN,0._r,ymin,0._r,ymax) ! draw y axis
call GWLINE(IRTN,0._r,ymax,-8*pxlx,ymax-8*pxly)
call GWLINE(IRTN,0._r,ymax, 8*pxlx,ymax-8*pxly)
do i = ceiling(ymin), floor(ymax)
call GWLINE(IRTN,-5*pxlx,i*1._r,5*pxlx,i*1._r)
enddo
call GWPUTTXT(IRTN,xmax-20*pxlx,-25*pxly,"X")
x1 = xmin; y1=sin(x1) ; res = 200 ! draw function
call GWMOVE2(IRTN,x1,y1)
do i = 1, res
x2 = xmin + i * (xmax-xmin) / res
y2 = sin(x2)
call GWLINE2(IRTN,x2,y2)
enddo
call GWPUTTXT(IRTN,15*pxlx,ymax-25*pxly,"Y")
call GWSETTXT(IRTN,0._r,0._r,4,-1,-1,'') ! text settings for top-left centering
call GWPUTTXT(IRTN,xmin+5*pxlx,ymax,"y=sin(x)")
call GWSETMSG(IRTN,"Representation de y=sin(x)") ! text in status bar
call GWQUIT(IRTN) ! close graphics window
end Program Main
Le lien qui suit vous permet d'accéder directement à cet exemple de base.