|
A bubble plot lets you chart three variables in two dimensions by varying the size of each data point in a scatter plot based on a third variable. In GRAPH-XT, that third variable is taken from the Y values of a separate curve. The source curve for the bubble amplitudes will not be drawn. GRAPH-XT ignores the X values for the source curve(s); the n’th point of the source curve is used as the bubble amplitude for the n’th point of the selected curve, regardless of whether the X values match up.
The following chapter shows how to create a simple bubble plot like this:
Doc_num=FNDplot_doc_new(0) ! create new document |
Xmin=0 Xmax=2*PI Xpoints=50 Xstep=Xmax/Xpoints Ymin=0 Ymax=2*PI Ypoints=100 Ystep=Ymax/Ypoints ALLOCATE REAL Datxy(1:Xpoints,1:2) ! 2-dimensional array ALLOCATE REAL Datxy2(1:Xpoints,1:2) ! used for z values for bubble plot ! Xi=BASE(Datxy,1) FOR X=Xmin TO Xmax STEP Xstep Datxy(Xi,1)=COS(X) ! x value 1st curve Datxy(Xi,2)=SIN(X) ! y value 1st curve Datxy2(Xi,1)=COS(X) ! x value 2nd curve ! y value 2nd curve (used for symbol size for first curve = bubble plot) Datxy2(Xi,2)=ABS(SIN(X)) IF Xi<Xpoints THEN Xi=Xi+1 NEXT X |
! transfer all data points to DPlot curve 1, line type 1 Dummy=FNDplot_xyz_data(Doc_num,Datxy(*),0,0,1,"x=cos(t), y=sin(t); {0<t<2*PI}",1) ! transfer all data points to DPlot curve 2, line type 1 Dummy=FNDplot_xyz_data(Doc_num,Datxy2(*),0,0,2,"x=cos(t), y=abs(y); {0<t<2*PI}",1) DEALLOCATE Datxy(*) |
CALL Dplot_scr_size(Dw,Dh) ! get screen size Sl=100 ! size of symbols for low values Sh=300 ! size of symbols for high values IF Dw<800 THEN Sl=60 ! looks better on small displays Sh=180 ! looks better on small displays END IF ! ! The following command creates the bubble plot. ! Sets bubble plot parameters for the curve with 1-based index curve. ! The symbol type is specified by the symbol parameter (see all ! available symbol types in the description of the SymbolType command). ! The symbol size will be based on the Y values of the curve with 1-based ! index source. The source curve will not be drawn. ! The X values for the source curve are ignored. ! Dummy=FNDplot_send_cmd("[Bubbles(1,288,2,"&VAL$(Sl)&","&VAL$(Sh)&",0xFF0000,0x0000FF)]") |
! 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("[NumberFormat(0,8)]") ! x axis = fractions of PI Dummy=FNDplot_send_cmd("[ManualScale(-1.1,-1.20,1.1,1.20)]") ! manual scale of y axis |
! show the diagram, 100% screen size CALL Dplot_show(Doc_num) Dummy=FNDplot_doc_close(Doc_num) ! close the document |