!______________________________________________________________________________ ! This program demonstrates how to use the SimpleGraphics module to plot 2D curves ! It plots the function y=x^2 exactly and with random deviations. !______________________________________________________________________________ PROGRAM DISLIN_test USE Simple_Graphics IMPLICIT NONE INTEGER, PARAMETER :: wp=KIND(0.0D0) INTEGER, PARAMETER :: N=20 INTEGER :: i REAL(KIND=wp), DIMENSION(N) :: X,Y,DELTA,Y_ ! This part sets up the arrays to plot ! X, Y=X**2 and Y_=Y+[Random deviations] ! Don't worry about this syntax yet !__________________________________ X=REAL((/(i,i=1,N)/),wp)/REAL(N,wp) Y=X**2 CALL RANDOM_NUMBER(DELTA) DELTA=0.2_wp*(DELTA-0.5_wp) Y_=Y+DELTA !__________________________________ DO i=1,1 ! This is an example of using Plot2D plot: CALL InitGraphics(file="Test2D.png",file_type="PNG", & n_plots=2, tick_labels="9F1", legend_position="UL", & plot_title=(/"Example of 2D plot of the function $y=x^2+\delta y$ and a fit", & "A. Donev 1/18/2001 "/), & x_label="$x$",y_label="$y$") CALL Plot2D(x=X,y=Y,line_spec=(/7,5/),color_spec=(/0,3/), & legend="$y=x^2$",axis=(/0.0_wp,1.0_wp,0.0_wp,1.0_wp/)) CALL Plot2D(x=X,y=Y_,line_spec=(/2,2/),symbol_spec=(/15,25/),color_spec=(/0,2/), & legend="$y=x^2+\delta y$") CALL EndGraphics() END DO END PROGRAM DISLIN_test