Navigation:  Welcome to GRAPH-XT > Getting Started >

Getting Started with XY Plots

 

Previous pageReturn to chapter overviewNext page
Show/Hide Hidden Text

lampe

Info: Some very detailed examples for XY plots can be found in the DPlot_example1.prg example program, see SUB Dplot_xygraph and SUB Dplot_lissajous.

 

The following chapter shows how to create a simple XY plot like this:

clip0037

 

hmtoggle_plus1Create a new document

Doc_num=FNDplot_doc_new(0)      ! create new document

 

hmtoggle_plus1Create the point pairs and store them into a 2D REAL array

Xmin=0

Xmax=2*PI

Xpoints=200

Xstep=Xmax/Xpoints

!

ALLOCATE REAL Datxy(1:Xpoints,1:2)   ! 2-dimensional array

!

Xi=BASE(Datxy,1)

FOR T=Xmin TO Xmax STEP Xstep

   Datxy(Xi,1)=SIN(2*T)         ! x = sin(2*t)

   Datxy(Xi,2)=SIN(5*T)         ! y = sin(5*t)

   IF Xi<Xpoints THEN Xi=Xi+1

NEXT T

 

hmtoggle_plus1Send the data points to DPlot

! transfer all data points to DPlot curve 1, line type 1

Dummy=FNDplot_xyz_data(Doc_num,Datxy(*),0,0,1,"x=sin(2t), y=sin(5t) {0<t<2PI}",1)

 

hmtoggle_plus1Some tweaking

! legend text and style for curve

Dummy=FNDplot_send_cmd("[Legend(1,""x=sin(2*t),y=sin(5*t)  {0<t<2*PI}"")]")

!

Dummy=FNDplot_send_cmd("[Color(1,0,128,0)]")   ! curve 1 = dark green

Dummy=FNDplot_send_cmd("[NumberFormat(0,8)]")  ! number format for x axis = fractions of PI

Dummy=FNDplot_send_cmd("[ManualScale(-1.1,-1.2,1.1,1.2)]") ! manual scale of y axis

 

hmtoggle_plus1Show the diagram on the HTBasic screen and close document

! show the diagram, 100% screen size

CALL Dplot_show(Doc_num)

Dummy=FNDplot_doc_close(Doc_num)     ! close the document