-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
16 changed files
with
475 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
PROGRAM main | ||
USE GlobalData, ONLY: I4B, DFP | ||
USE GnuPlot_Class | ||
IMPLICIT NONE | ||
TYPE(GnuPlot_) :: gp | ||
INTEGER(I4B), PARAMETER :: tsize = 17_I4B | ||
REAL(DFP) :: xval(tsize) | ||
REAL(DFP) :: yval(tsize) | ||
|
||
xval = DBLE([-8, -7, -6, -5, -4, -3, -2, & | ||
-1, 0, 1, 2, 3, 4, 5, 6, 7, 8]) | ||
yval = DBLE([66, 51, 38, 27, 18, 11, 6, 3, & | ||
2, 3, 6, 11, 18, 27, 38, 51, 66]) | ||
|
||
CALL gp%title('TEST 1. A simple xy plot') | ||
CALL gp%xlabel('x label ...') | ||
CALL gp%ylabel('y label ...') | ||
CALL gp%options('set style data linespoints') | ||
|
||
CALL gp%plot(xval, yval) | ||
|
||
END PROGRAM main | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
PROGRAM main | ||
USE GlobalData, ONLY: I4B, DFP, Pi | ||
USE GridPointUtility, ONLY: Linspace | ||
USE GnuPlot_Class | ||
IMPLICIT NONE | ||
TYPE(GnuPlot_) :: gp | ||
INTEGER, PARAMETER :: tsize = 40 | ||
INTEGER :: ii | ||
REAL(DFP) :: xval(tsize), yval(tsize, 4) | ||
|
||
xval = linspace(-pi, pi, tsize) | ||
yval(:, 1) = SIN(xval) | ||
yval(:, 2) = SIN(xval) * COS(xval) | ||
yval(:, 3) = (1.0_DFP - xval) * SIN(xval) | ||
yval(:, 4) = (1.0_DFP - xval) * COS(xval) | ||
|
||
! general options | ||
CALL gp%options('set tics font ",8"') | ||
|
||
!! nrow ncolumn | ||
CALL gp%multiplot(2, 2) | ||
|
||
DO ii = 1, 4 | ||
CALL gp%plot(xval, yval(:, ii), 'lt 4 pt 6') | ||
END DO | ||
! a new window will be started when all places in the multiplot | ||
! layout is occupied. | ||
|
||
END PROGRAM main | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
PROGRAM main | ||
USE GlobalData, ONLY: I4B, DFP, Pi | ||
USE GridPointUtility, ONLY: Linspace, MeshGrid | ||
USE GnuPlot_Class | ||
IMPLICIT NONE | ||
TYPE(GnuPlot_) :: gp | ||
INTEGER, PARAMETER :: tsize = 40 | ||
REAL(DFP), ALLOCATABLE :: xval(:, :), yval(:, :), zval(:, :) | ||
REAL(DFP), ALLOCATABLE :: xv(:) | ||
INTEGER :: nrow, ncol | ||
|
||
xv = linspace(-0.75_DFP * pi, 0.75_DFP * pi, tsize) | ||
CALL meshgrid(xval, yval, xv, xv) !xval=yval | ||
nrow = SIZE(xval, 1) | ||
ncol = SIZE(xval, 2) | ||
ALLOCATE (zval(nrow, ncol)) | ||
|
||
!z= sin(x) * cos (y) | ||
WHERE (xval**2 + yval**2 == 0.0_DFP) | ||
zval = 1.0_DFP | ||
ELSEWHERE | ||
zval = SIN(xval**2 + yval**2) / (xval**2 + yval**2) | ||
END WHERE | ||
|
||
CALL gp%title('TEST 11: Simple 3D plot with color palette') | ||
CALL gp%xlabel('x-axis,...') | ||
CALL gp%ylabel('y-axis,...') | ||
CALL gp%options('set style data lines') | ||
|
||
CALL gp%surf(xval, yval, zval, paletteName='jet') | ||
|
||
END PROGRAM main | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
PROGRAM main | ||
USE GlobalData, ONLY: I4B, DFP, Pi | ||
USE GridPointUtility, ONLY: Linspace, MeshGrid | ||
USE GnuPlot_Class | ||
IMPLICIT NONE | ||
TYPE(GnuPlot_) :: gp | ||
INTEGER, PARAMETER :: tsize = 55 | ||
REAL(DFP), ALLOCATABLE :: xval(:, :), yval(:, :), zval(:, :) | ||
REAL(DFP), ALLOCATABLE :: xv(:) | ||
REAL(DFP) :: a = -0.5_DFP | ||
REAL(DFP) :: b = 0.5_DFP | ||
INTEGER :: nrow, ncol | ||
|
||
! create 3D data | ||
xv = linspace(a, b, tsize) | ||
CALL meshgrid(xval, yval, xv, xv) | ||
nrow = SIZE(xval, 1) | ||
ncol = SIZE(xval, 2) | ||
ALLOCATE (zval(nrow, ncol)) | ||
|
||
zval = COS(2.0_DFP * pi * xval) * & | ||
SIN(2.0_DFP * pi * yval) | ||
|
||
CALL gp%title('TEST 12: A beautiful surface plot with hidden details') | ||
CALL gp%options('set hidden3d') | ||
CALL gp%options('unset key') | ||
! CALL gp%options('set contour base') | ||
|
||
CALL gp%surf(xval, yval, zval, paletteName='jet') | ||
|
||
CALL gp%contour(xval, yval, zval, paletteName='set1') | ||
|
||
END PROGRAM main | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
PROGRAM main | ||
USE GlobalData, ONLY: I4B, DFP, Pi | ||
USE GridPointUtility, ONLY: Linspace, MeshGrid | ||
USE GnuPlot_Class | ||
IMPLICIT NONE | ||
TYPE(GnuPlot_) :: gp | ||
INTEGER, PARAMETER :: ncol = 25, nrow = 45 | ||
REAL(DFP) :: xv(ncol), yv(nrow), time | ||
REAL(DFP), ALLOCATABLE :: xval(:, :), yval(:, :), zval(:, :) | ||
|
||
! generate data | ||
xv = linspace(0.0_DFP, 2.0_DFP * pi, ncol) | ||
yv = linspace(0.0_DFP, 2.0_DFP * pi, nrow) | ||
CALL meshgrid(xval, yval, xv, yv) | ||
zval = SIN(xval) + COS(yval) | ||
|
||
CALL gp%title('TEST 13. Animation of surface plot') | ||
CALL gp%axis([0.0_DFP, 2.0 * pi, 0.0_DFP, 2.0 * pi]) | ||
CALL gp%options('unset colorbox') | ||
CALL gp%options('set ticslevel 0') | ||
CALL gp%axis([0.0_DFP, 2.0 * pi, 0.0_DFP, 2.0 * pi, -2.0_DFP, 2.0_DFP]) | ||
|
||
CALL gp%animationStart(1.0_DFP) | ||
time = 0.050_DFP | ||
|
||
DO | ||
|
||
CALL gp%surf(xval, yval, SIN(time * pi / 2.0) * zval, & | ||
paletteName='jet') | ||
time = time + 0.1_DFP | ||
IF (time > 1.0_DFP) EXIT | ||
|
||
END DO | ||
|
||
CALL gp%animationShow() | ||
|
||
END PROGRAM main | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
PROGRAM main | ||
USE GlobalData, ONLY: I4B, DFP, Pi | ||
USE GridPointUtility, ONLY: Linspace | ||
USE GnuPlot_Class | ||
IMPLICIT NONE | ||
TYPE(GnuPlot_) :: gp | ||
INTEGER, PARAMETER :: tsize = 80 | ||
REAL(DFP) :: xval(tsize), yval(tsize), zval(tsize) | ||
REAL(DFP) :: xv(tsize) | ||
|
||
xv = linspace(-2.0_DFP * pi, 2.0_DFP * pi, tsize) | ||
xval = COS(xv) | ||
yval = SIN(xv) | ||
zval = linspace(0.0_DFP, 2.0_DFP, tsize) | ||
|
||
CALL gp%plot3d(x=xval, y=yval, z=zval, & | ||
lspec="with linespoints pt 8 ps 2") | ||
|
||
END PROGRAM main | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
PROGRAM main | ||
USE GlobalData, ONLY: I4B, DFP, Pi | ||
USE GridPointUtility, ONLY: Linspace, MeshGrid | ||
USE GnuPlot_Class | ||
IMPLICIT NONE | ||
TYPE(GnuPlot_) :: gp | ||
INTEGER, PARAMETER :: tsize = 40 | ||
REAL(DFP), ALLOCATABLE :: xval(:, :), yval(:, :) | ||
REAL(DFP), ALLOCATABLE :: zval1(:, :), zval2(:, :) | ||
REAL(DFP) :: xv(tsize) | ||
INTEGER :: nrow, ncol | ||
|
||
xv = linspace(-pi, pi, tsize) | ||
CALL meshgrid(xval, yval, xv, xv) | ||
|
||
nrow = SIZE(xval, 1) | ||
ncol = SIZE(xval, 2) | ||
ALLOCATE (zval1(nrow, ncol)) | ||
ALLOCATE (zval2(nrow, ncol)) | ||
|
||
zval1 = SIN(xval) + COS(yval) | ||
zval2 = SIN(xval) * COS(yval) | ||
|
||
CALL gp%options('unset key') | ||
CALL gp%axis([-pi, pi, -pi, pi]) | ||
CALL gp%options('unset colorbox') | ||
CALL gp%options('set autoscale fix') | ||
CALL gp%options('unset tics') | ||
|
||
CALL gp%title('TEST 15: Contour plot') | ||
CALL gp%multiplot(1, 2) | ||
CALL gp%surf(xval, yval, zval1) | ||
CALL gp%surf(xval, yval, zval2) | ||
|
||
CALL gp%multiplot(2, 1) | ||
CALL gp%options('set colorbox') | ||
CALL gp%options('set tics') | ||
CALL gp%options('set tics font ",8"') | ||
CALL gp%contour(xval, yval, zval1, paletteName='jet') | ||
CALL gp%contour(xval, yval, zval2, paletteName='set1') | ||
|
||
END PROGRAM main | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
PROGRAM main | ||
USE GlobalData, ONLY: I4B, DFP, Pi | ||
USE GridPointUtility, ONLY: Linspace | ||
USE GnuPlot_Class | ||
IMPLICIT NONE | ||
|
||
TYPE(GnuPlot_) :: gp | ||
INTEGER(I4B), PARAMETER :: tsize1 = 50 | ||
INTEGER(I4B), PARAMETER :: tsize2 = 50 | ||
REAL(DFP) :: xval1(tsize1), xval2(tsize2) | ||
REAL(DFP) :: yval1(tsize1), yval2(tsize2) | ||
|
||
xval1 = linspace(-pi, pi, tsize1) | ||
yval1 = SIN(xval1) | ||
|
||
xval2 = linspace(0.0_DFP, 2.0_DFP * pi, tsize2) | ||
yval2 = COS(2.0_DFP * xval2) | ||
|
||
! This is the maximum number of plot can be drawn at the same time | ||
! If you have more data see, you can plot can be used with matrices! | ||
CALL gp%title('TEST 2. Plot four data sets using gnuplot') | ||
CALL gp%options('set key top left; set grid') | ||
|
||
CALL gp%plot(x1=xval1, y1=yval1, ls1='title "sin(x)"', & | ||
x2=xval2, y2=yval2, ls2='with lp lt 6 title "cos(2x)"', & | ||
x3=xval2, y3=2.0_DFP * yval2, ls3='title "2cos(2x)" lt 7', & | ||
x4=xval2, y4=0.5_DFP * yval2, & | ||
ls4='title "0.5cos(2x)" with points pt 8') | ||
|
||
END PROGRAM main | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
PROGRAM main | ||
USE GlobalData, ONLY: I4B, DFP, Pi | ||
USE GridPointUtility, ONLY: Linspace | ||
USE GnuPlot_Class | ||
IMPLICIT NONE | ||
TYPE(GnuPlot_) :: gp | ||
INTEGER(i4b), PARAMETER :: tsize = 125 | ||
REAL(DFP) :: xval(tsize) | ||
REAL(DFP) :: yval(tsize) | ||
|
||
xval = linspace(0.0_DFP, pi * 2.0_DFP, tsize) | ||
yval = SIN(6.0_DFP * xval) * EXP(-xval) | ||
|
||
CALL gp%title('TEST 2. A sample shows sin(x) and its zero on the plot') | ||
CALL gp%xlabel('x, rad') | ||
CALL gp%ylabel('sin(x), dimensionless') | ||
CALL gp%options('set grid') | ||
|
||
CALL gp%plot(x1=xval, y1=yval, & | ||
ls1='title "sin(x)" with lines lt 2 lw 3', & | ||
x2=[pi], y2=[0.D0], & | ||
ls2='title "zero" with points pt 7 ps 3 lc rgb "#FF0000"') | ||
|
||
END PROGRAM main | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
PROGRAM main | ||
USE GlobalData, ONLY: I4B, DFP, Pi | ||
USE GridPointUtility, ONLY: Linspace | ||
USE GnuPlot_Class | ||
IMPLICIT NONE | ||
TYPE(GnuPlot_) :: gp | ||
INTEGER(I4B), PARAMETER :: nrow = 25, ncol = 6 | ||
INTEGER(I4B) :: ii | ||
REAL(DFP) :: tf, vo, g | ||
REAL(DFP) :: tval(nrow), yval(nrow, ncol) | ||
|
||
tf = 10.0_DFP | ||
g = 32.0_DFP; | ||
tval = linspace(0.0_DFP, tf, nrow) | ||
DO ii = 1, ncol | ||
vo = 25.0_DFP * ii | ||
yval(:, ii) = vo * tval - 0.5_DFP * g * tval**2 | ||
END DO | ||
|
||
CALL gp%title('TEST 8.1: Plotting a Matrix against a vector') | ||
CALL gp%xlabel('t, sec') | ||
CALL gp%ylabel('y, feet') | ||
CALL gp%options('set xrange[0:10]; set yrange [0:400];') | ||
CALL gp%plot(tval, yval) | ||
|
||
CALL gp%title('TEST 8.2: Matrix plot, legends and linespec') | ||
CALL gp%plot(tval, 2.0D0 * yval(:, 3:4), & | ||
lspec='t "vo=100" w lp lt 6 ps 3 lw 2;'// & | ||
't "v=125"w lp lt 7 ps 3 lw 2 lc rgb "#ad6000"') | ||
|
||
END PROGRAM main | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
PROGRAM main | ||
USE GlobalData, ONLY: I4B, DFP, Pi | ||
USE GridPointUtility, ONLY: Linspace | ||
USE GnuPlot_Class | ||
IMPLICIT NONE | ||
TYPE(GnuPlot_) :: gp | ||
INTEGER, PARAMETER :: tsize = 35 | ||
REAL(DFP) :: xval(tsize) | ||
REAL(DFP) :: yval(tsize), zval(tsize) | ||
INTEGER(I4B) :: ii | ||
|
||
xval = linspace(-pi, pi, tsize) | ||
yval = 0.0_DFP | ||
zval = 0.0_DFP | ||
CALL gp%animationStart(1.0_DFP) | ||
CALL gp%axis([-pi, pi, -1.2_DFP, 1.2_DFP]) | ||
CALL gp%options('set grid') | ||
|
||
yval = SIN(xval) | ||
zval = COS(xval) | ||
|
||
DO ii = 1, tsize, 5 | ||
CALL gp%plot(x1=xval(1:ii), y1=yval(1:ii), & | ||
ls1='w lines lc "red" lw 2', & | ||
x2=xval(ii:ii), y2=yval(ii:ii), & | ||
ls2='w points ps 3 pt 7 lc "red"', & | ||
x3=xval(1:ii), y3=zval(1:ii), & | ||
ls3='w lines lc "blue" lw 2', & | ||
x4=xval(ii:ii), y4=zval(ii:ii), & | ||
ls4='w points ps 3 pt 7 lc "blue"') | ||
END DO | ||
|
||
CALL gp%animationShow() | ||
|
||
END PROGRAM main | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
PROGRAM main | ||
USE GlobalData, ONLY: I4B, DFP, Pi | ||
USE GridPointUtility, ONLY: Linspace | ||
USE GnuPlot_Class | ||
IMPLICIT NONE | ||
TYPE(GnuPlot_) :: gp | ||
INTEGER, PARAMETER :: tsize = 125 | ||
REAL(DFP) :: tval(tsize), rval(tsize) | ||
|
||
CALL gp%options("set polar; set trange [-pi:pi]") | ||
|
||
tval = linspace(-pi, pi, tsize) | ||
rval = SIN(3.0_DFP * tval) | ||
|
||
CALL gp%title("TEST 6: simple polar plot") | ||
CALL gp%xlabel("x,...") | ||
CALL gp%ylabel("y,...") | ||
|
||
! CALL gp%plot(tval, rval, 'title "sin(3t)"') | ||
CALL gp%plot(tval, COS(4.0_DFP * tval)) | ||
|
||
END PROGRAM main | ||
|
Oops, something went wrong.