kookma / ogpf

ogpf is Object based interface to GnuPlot from Fortran 2003, 2008 and later
Other
167 stars 47 forks source link

use real(x, kind=wp) instead of dble(x) #45

Open Beliavsky opened 1 year ago

Beliavsky commented 1 year ago

In the subroutine below it is better to write

x=real([-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8], kind=wp)

instead of

x=dble([-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8])

for flexibility.

    subroutine exmp01

        type(gpf):: gp
        integer, parameter:: n=17
        real(wp):: x(n)
        real(wp):: y(n)
        ! Input data
  !      x=dble([-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8])
        x=dble([-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8])

        x= abs(x) + 5

        y=dble([66,51,38,27,18,11,6,3,2,3,6,11,18,27,38,51,66])

        ! Annotation: set title, xlabel, ylabel
        call gp%title('Example 1. A simple xy plot','#990011')
        call gp%xlabel('my x axis ...','#99aa33',font_name="Tahoma")
       ! call gp%ylabel('my y axis ...')
        call gp%options('set border lc "#99aa33"; set ylabel "my label..." tc "#99aa33"')

        call gp%options('set logscale y2')
        call gp%plot(x, y)

    end subroutine exmp01

The program does not compile if wp = sp in ogpf.f90.

kookma commented 1 year ago

much appreciated. Do you have time to submit a PR?