diff --git a/docs/docs-api/Gnuplot/examples/Gnuplot_test_1.F90 b/docs/docs-api/Gnuplot/examples/Gnuplot_test_1.F90 new file mode 100644 index 00000000..e36484ce --- /dev/null +++ b/docs/docs-api/Gnuplot/examples/Gnuplot_test_1.F90 @@ -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 + diff --git a/docs/docs-api/Gnuplot/examples/Gnuplot_test_10.F90 b/docs/docs-api/Gnuplot/examples/Gnuplot_test_10.F90 new file mode 100644 index 00000000..b44d7473 --- /dev/null +++ b/docs/docs-api/Gnuplot/examples/Gnuplot_test_10.F90 @@ -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 + diff --git a/docs/docs-api/Gnuplot/examples/Gnuplot_test_11.F90 b/docs/docs-api/Gnuplot/examples/Gnuplot_test_11.F90 new file mode 100644 index 00000000..9295be4b --- /dev/null +++ b/docs/docs-api/Gnuplot/examples/Gnuplot_test_11.F90 @@ -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 + diff --git a/docs/docs-api/Gnuplot/examples/Gnuplot_test_12.F90 b/docs/docs-api/Gnuplot/examples/Gnuplot_test_12.F90 new file mode 100644 index 00000000..5ece5a37 --- /dev/null +++ b/docs/docs-api/Gnuplot/examples/Gnuplot_test_12.F90 @@ -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 + diff --git a/docs/docs-api/Gnuplot/examples/Gnuplot_test_13.F90 b/docs/docs-api/Gnuplot/examples/Gnuplot_test_13.F90 new file mode 100644 index 00000000..43aea124 --- /dev/null +++ b/docs/docs-api/Gnuplot/examples/Gnuplot_test_13.F90 @@ -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 + diff --git a/docs/docs-api/Gnuplot/examples/Gnuplot_test_14.F90 b/docs/docs-api/Gnuplot/examples/Gnuplot_test_14.F90 new file mode 100644 index 00000000..c15d7253 --- /dev/null +++ b/docs/docs-api/Gnuplot/examples/Gnuplot_test_14.F90 @@ -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 + diff --git a/docs/docs-api/Gnuplot/examples/Gnuplot_test_15.F90 b/docs/docs-api/Gnuplot/examples/Gnuplot_test_15.F90 new file mode 100644 index 00000000..03847dfb --- /dev/null +++ b/docs/docs-api/Gnuplot/examples/Gnuplot_test_15.F90 @@ -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 + diff --git a/docs/docs-api/Gnuplot/examples/Gnuplot_test_2.F90 b/docs/docs-api/Gnuplot/examples/Gnuplot_test_2.F90 new file mode 100644 index 00000000..3d990d1c --- /dev/null +++ b/docs/docs-api/Gnuplot/examples/Gnuplot_test_2.F90 @@ -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 + diff --git a/docs/docs-api/Gnuplot/examples/Gnuplot_test_3.F90 b/docs/docs-api/Gnuplot/examples/Gnuplot_test_3.F90 new file mode 100644 index 00000000..b96fcea8 --- /dev/null +++ b/docs/docs-api/Gnuplot/examples/Gnuplot_test_3.F90 @@ -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 + diff --git a/docs/docs-api/Gnuplot/examples/Gnuplot_test_4.F90 b/docs/docs-api/Gnuplot/examples/Gnuplot_test_4.F90 new file mode 100644 index 00000000..4e67c74a --- /dev/null +++ b/docs/docs-api/Gnuplot/examples/Gnuplot_test_4.F90 @@ -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 + diff --git a/docs/docs-api/Gnuplot/examples/Gnuplot_test_5.F90 b/docs/docs-api/Gnuplot/examples/Gnuplot_test_5.F90 new file mode 100644 index 00000000..9f8a5817 --- /dev/null +++ b/docs/docs-api/Gnuplot/examples/Gnuplot_test_5.F90 @@ -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 + diff --git a/docs/docs-api/Gnuplot/examples/Gnuplot_test_6.F90 b/docs/docs-api/Gnuplot/examples/Gnuplot_test_6.F90 new file mode 100644 index 00000000..abb36de4 --- /dev/null +++ b/docs/docs-api/Gnuplot/examples/Gnuplot_test_6.F90 @@ -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 + diff --git a/docs/docs-api/Gnuplot/examples/Gnuplot_test_7.F90 b/docs/docs-api/Gnuplot/examples/Gnuplot_test_7.F90 new file mode 100644 index 00000000..9abc5bd3 --- /dev/null +++ b/docs/docs-api/Gnuplot/examples/Gnuplot_test_7.F90 @@ -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 = 25 +REAL(DFP) :: xval(tsize), yval(tsize) + +xval = linspace(0.10_DFP, 10.0_DFP, tsize) +yval = 5.0_DFP * xval**3 + 4.0_DFP * xval**2 + & + 3.0_DFP * xval + 1.0_DFP + +CALL gp%title("TEST 7.1: A simple matrix plot with semi-log y") +CALL gp%ylabel("y,logarithmic scale") +CALL gp%xlabel("x, normal scale") + +CALL gp%plot(xval, RESHAPE([yval, 10.0_DFP * yval], [tsize, 2]), & + 'with lines lt 8; with points pt 7', & + logScale="semilogy") + +CALL gp%reset() + +xval = EXP(linspace(0.0_DFP, 2.0_DFP * pi, tsize)) +yval = 50.0_DFP + EXP(3.0_DFP * linspace(0.0_DFP, 2.0_DFP * pi, tsize)) + +CALL gp%title("TEST 7.2: A loglog plot") +CALL gp%xlabel("x,logarithmic scale") +CALL gp%ylabel("y,logarithmic scale") + +CALL gp%options('set grid xtics ytics mxtics') + +CALL gp%plot(xval, yval, logScale="loglog") + +END PROGRAM main + diff --git a/docs/docs-api/Gnuplot/examples/Gnuplot_test_8.F90 b/docs/docs-api/Gnuplot/examples/Gnuplot_test_8.F90 new file mode 100644 index 00000000..b8cec068 --- /dev/null +++ b/docs/docs-api/Gnuplot/examples/Gnuplot_test_8.F90 @@ -0,0 +1,28 @@ +PROGRAM main +USE GlobalData, ONLY: I4B, DFP, Pi +USE GridPointUtility, ONLY: Linspace +USE GnuPlot_Class +IMPLICIT NONE +TYPE(GnuPlot_) :: gp +INTEGER, PARAMETER :: tsize = 40 +REAL(DFP) :: xval(tsize), yval(tsize) +INTEGER :: ii + +xval = linspace(0.0_DFP, 4.0_DFP * pi, tsize) +yval = EXP(-xval / 4.0_DFP) * SIN(xval) + +!! specify the file name for future use +CALL gp%filename("stemAnimation.plt") + +CALL gp%axis([0.0_DFP, 4.0_DFP * pi, -1.0_DFP, 1.0_DFP]) + +CALL gp%animationStart(0.1_DFP) +DO ii = 1, tsize + CALL gp%plot(x1=xval(1:ii), y1=yval(1:ii), ls1='with impulses lw 2', & + x2=xval(1:ii), y2=yval(1:ii), ls2='with points pt 6') +END DO + +CALL gp%animationShow() + +END PROGRAM main + diff --git a/docs/docs-api/Gnuplot/examples/Gnuplot_test_9.F90 b/docs/docs-api/Gnuplot/examples/Gnuplot_test_9.F90 new file mode 100644 index 00000000..2c27e067 --- /dev/null +++ b/docs/docs-api/Gnuplot/examples/Gnuplot_test_9.F90 @@ -0,0 +1,19 @@ +PROGRAM main +USE GnuPlot_Class +IMPLICIT NONE +TYPE(GnuPlot_) :: gp + +! Script is used to create multi window plots +! Each "set term wxt " creates a new window + +CALL gp%addScript('set term wxt 0 title "My first plot" size 640,480') +CALL gp%addScript('set title "TEST 9. Multi windows plot using script"') +CALL gp%addScript('plot x*x+2*x+1') +CALL gp%addScript('set term wxt 1 title "My second plot"') +CALL gp%addScript('set ylabel "xsin(x)"') +CALL gp%addScript('plot x*sin(x)') + +CALL gp%runScript() + +END PROGRAM main + diff --git a/docs/docs-api/Gnuplot/index.md b/docs/docs-api/Gnuplot/index.md new file mode 100644 index 00000000..e7bdca2c --- /dev/null +++ b/docs/docs-api/Gnuplot/index.md @@ -0,0 +1,24 @@ +--- +sidebar_position: 1 +date: 2024-09-22 +update: 2024-09-22 +status: stable +docs: done +extpkgs: + - Gnuplot +category: + - Plotting + - Visualization +tags: + - plot + - extpkgs + - plotting + - visualization + - easifemClasses +--- + +# Gnuplot + +import DocCardList from '@theme/DocCardList'; + +