showfig Subroutine

private subroutine showfig(me, pyfile, istat, python)

Shows the figure.

Type Bound

pyplot

Arguments

Type IntentOptional Attributes Name
class(pyplot), intent(inout) :: me

pyplot handler

character(len=*), intent(in), optional :: pyfile

name of the Python script to generate

integer, intent(out), optional :: istat

status output (0 means no problems)

character(len=*), intent(in), optional :: python

python executable to use. (by default, this is 'python')


Calls

proc~~showfig~~CallsGraph proc~showfig pyplot_module::pyplot%showfig proc~add_str pyplot_module::pyplot%add_str proc~showfig->proc~add_str proc~execute pyplot_module::pyplot%execute proc~showfig->proc~execute proc~finish_ops pyplot_module::pyplot%finish_ops proc~showfig->proc~finish_ops proc~finish_ops->proc~add_str

Source Code

    subroutine showfig(me, pyfile, istat, python)

    class(pyplot),    intent(inout)          :: me      !! pyplot handler
    character(len=*), intent(in), optional   :: pyfile  !! name of the Python script to generate
    integer,          intent (out), optional :: istat   !! status output (0 means no problems)
    character(len=*), intent(in),optional    :: python  !! python executable to use. (by default, this is 'python')

    if (.not. allocated(me%str)) then

        if (present(istat)) istat = -1
        write(error_unit,'(A)') 'error in showfig: pyplot class not properly initialized.'

    else if (me%use_oo_api) then

        if (present(istat)) istat = -2
        write(error_unit,'(A)') 'error in showfig: not compatible with "use_oo_api" option'

    else

        if (present(istat)) istat = 0

        !finish up the string:
        call me%finish_ops()

        !show figure:
        call me%add_str('plt.show()')

        !run it:
        call me%execute(pyfile, istat=istat, python=python)

    end if

    end subroutine showfig