Hi, I'm a student majoring in aerospace engineering in South Korea.
Because of my major, recently I'm studying about fortran and facing many of errors.
My current issue is graphic problems.
I want to draw a 2-D graph with two 1-D array(i.e. X&Y array) data.
So I found a subroutine and below is that.
At first time, there are 4 errors of error code 2019-they are about external symbol- and a fatal error code of 1120.
After a searching for related articles in this forum, I found the way which about project option(?)
fortran-libraries-runtime library-->quickwin
& linker-system-subsystem-->console
By setting the options like this I finally have no errors and can see a new black window.
But I still have no graph output. I have only a black window.
So, I need some help for solving this problem and I hope you guys help me to see the graph out.
Thank you.
SUBROUTINE grph(X,Y,IMAX,xmin,xmax,ymin,ymax)
C================================================================
DIMENSION X(1),Y(1)
C
RTX = 10.0 / (XMAX - XMIN)
RTY = 10.0 / (YMAX - YMIN)
C
ICOLG=2
ICOLP=22
ICOLN=49
C============================================================
XO = -XMIN * RTX + 1.5
YO = -YMIN * RTY - 2.5
C
CALL PLOTS(0,1,16)
CALL NEWPEN(0)
C
C --- X-AXIES PLOT
C
DX=(XMAX-XMIN)/10.0
XAX=xmin
X1 =XO
Y1 =YO
CALL PLOT(X1,Y1,3)
DO 35 I=1,10
XAX=XAX+DX
X1 =XO+XAX*RTX
Y1=YO
CALL PLOT(X1,Y1,2)
CALL PLOT(X1,Y1+0.05,2)
CALL PLOT(X1,Y1,2)
35 CONTINUE
C --- Y-AXIES PLOT
C
DY=(YMAX-YMIN)/10.0
YAX=ymin
X1 =XO
Y1 =YO
CALL PLOT(X1,Y1,3)
DO 36 I=1,10
YAX=YAX+DY
X1 =XO
Y1=YO+YAX*RTY
CALL PLOT(X1,Y1,2)
CALL PLOT(X1+0.05,Y1,2)
CALL PLOT(X1,Y1,2)
36 CONTINUE
C
C PLOT GRAPH
call newpen(icolg)
IF(IMAX.LE.1) RETURN
DO I=2,IMAX
X1 =XO+X(I-1)*RTX
Y1 =YO+Y(I-1)*RTY
CALL PLOT(X1,Y1,3)
X1 =XO+X(I)*RTX
Y1 =YO+Y(I)*RTY
CALL PLOT(X1,Y1,2)
C CALL CIRCLE(X1,Y1,0.05,6)
ENDDO
C--------------------------------------------------------------
RETURN
END
C------------------------------------------------------------
C
C---------------------------------------------------------------
SUBROUTINE CIRCLE(XO,YO,R,M)
DTH=6.28385308/FLOAT(M)
THETA=0.0
X1=XO+R
Y1=YO
CALL PLOT(X1,Y1,3)
DO I=1,M
THETA=THETA+DTH
X1=XO+R*COS(THETA)
Y1=YO+R*SIN(THETA)
CALL PLOT(X1,Y1,2)
ENDDO
RETURN
END
c----------------------------------------------------------------------------------------------
c Initialize the Graphic Mode
c----------------------------------------------------------------------------------------------
SUBROUTINE plots(ii,jj,id)
USE IFQWIN
LOGICAL modestatus
INTEGER(2) maxx, maxy
TYPE (windowconfig) myscreen
COMMON maxx, maxy
c Set highest resolution graphics mode.
if(id.gt.0) then
myscreen.numxpixels=-1
myscreen.numypixels=-1
myscreen.numtextcols=-1
myscreen.numtextrows=-1
myscreen.numcolors=-1
myscreen.fontsize=-1
myscreen.title = ""C ! blank
modestatus=SETWINDOWCONFIG(myscreen)
i=ii; i=jj
i=i
end if
return
END
c---------------------------------------------------------------------------------------------
c DRAWLINES - This subroutine draws a line and move the pen.
c---------------------------------------------------------------------------------------------
SUBROUTINE plot(x,y,id)
USE IFQWIN
INTEGER(2) status,ix,iy
TYPE (xycoord) xy
ix=int2(x*100.+.5); iy=int2(700.-y*100.+.5)
if(id.eq.3) then
CALL MOVETO(ix,iy, xy )
else if (id.eq.2) then
status = LINETO(ix, iy)
endif
return
end
c------------------------------------------------------------------------------------------
c Set the pen collor
c------------------------------------------------------------------------------------------
SUBROUTINE NEWPEN(ICOLR)
USE IFQWIN
INTEGER(4) oldcolor,COLOR
C
COLR=FLOAT(ICOLR)
IF(colr.EQ.0.) THEN
color=#FFFFFF
ELSE if(colr.ge.1. .and. colr.lt.16.) then
color=#0000FF
COLOR=color+INT4(COLR*4096.)
else if(colr.ge.16. .and. colr.lt.31.) then
color=#00FFFF
COLOR=color-INT4((ICOLR-15.)*16.)
else if(colr.ge.31. .and. colr.lt.47.) then
color=#00FF00
COLOR=color+INT4((COLR-15.)*4096.*256.)
else if(colr.ge.48. .and. colr.lt.63.) then
color=#FFFF00
COLOR=color-INT4((COLR-48.)*4096.)
else if(colr.ge.64. ) then
color=#FF0000
COLOR=color-INT4((COLR-48.)*4096.*16.)+INT4((COLR-64.)*17.)
endif
oldcolor = SETCOLORRGB(COLOR)
return
END