@@ -1336,16 +1336,18 @@ end subroutine matrix_to_string
13361336! If user specifies a Python file name, then the file is kept, otherwise
13371337! a temporary filename is used, and the file is deleted after it is used.
13381338
1339- subroutine execute (me , pyfile , istat )
1339+ subroutine execute (me , pyfile , istat , python )
13401340
13411341 class(pyplot), intent (inout ) :: me ! ! pytplot handler
13421342 character (len=* ), intent (in ), optional :: pyfile ! ! name of the python script to generate
13431343 integer , intent (out ),optional :: istat ! ! status output (0 means no problems)
1344+ character (len=* ), intent (in ),optional :: python ! ! python executable to use. (by default, this is 'python')
13441345
13451346 integer :: iunit ! ! IO unit
13461347 character (len= :), allocatable :: file ! ! file name
13471348 logical :: scratch ! ! if a scratch file is to be used
13481349 integer :: iostat ! ! open/close status code
1350+ character (len= :), allocatable :: python_ ! ! python executable to use
13491351
13501352 if (allocated (me% str)) then
13511353
@@ -1379,12 +1381,18 @@ subroutine execute(me, pyfile, istat)
13791381 write (error_unit,' (A)' ) ' Error closing file: ' // trim (file)
13801382 else
13811383
1384+ if (present (python)) then
1385+ python_ = trim (python)
1386+ else
1387+ python_ = python_exe
1388+ end if
1389+ 13821390 ! run the file using python:
13831391 if (index (file,' ' )>0 ) then
13841392 ! space in path, probably should enclose in quotes
1385- call execute_command_line(python_exe // ' "' // file// ' "' )
1393+ call execute_command_line(python_ // ' "' // file// ' "' )
13861394 else
1387- call execute_command_line(python_exe // ' ' // file)
1395+ call execute_command_line(python_ // ' ' // file)
13881396 end if
13891397
13901398 if (scratch) then
@@ -1466,7 +1474,7 @@ end subroutine finish_ops
14661474! * modified: Johannes Rieke 6/16/2017
14671475! * modified: Jacob Williams 6/16/2017
14681476
1469- subroutine savefig (me , figfile , pyfile , dpi , transparent , facecolor , edgecolor , orientation , istat )
1477+ subroutine savefig (me , figfile , pyfile , dpi , transparent , facecolor , edgecolor , orientation , istat , python )
14701478
14711479 class(pyplot), intent (inout ) :: me ! ! pyplot handler
14721480 character (len=* ), intent (in ) :: figfile ! ! file name for the figure
@@ -1478,6 +1486,7 @@ subroutine savefig(me, figfile, pyfile, dpi, transparent, facecolor, edgecolor,
14781486 character (len=* ), intent (in ), optional :: edgecolor ! ! the colors of the figure rectangle
14791487 character (len=* ), intent (in ), optional :: orientation ! ! 'landscape' or 'portrait'
14801488 integer , intent (out ), optional :: istat ! ! status output (0 means no problems)
1489+ character (len=* ), intent (in ),optional :: python ! ! python executable to use. (by default, this is 'python')
14811490
14821491 character (len= :),allocatable :: tmp ! ! for building the `savefig` arguments.
14831492
@@ -1510,7 +1519,7 @@ subroutine savefig(me, figfile, pyfile, dpi, transparent, facecolor, edgecolor,
15101519 deallocate (tmp)
15111520
15121521 ! run it:
1513- call me% execute(pyfile, istat= istat)
1522+ call me% execute(pyfile, istat= istat, python = python )
15141523
15151524 else
15161525 if (present (istat)) istat = - 1
@@ -1526,11 +1535,12 @@ end subroutine savefig
15261535!
15271536! Shows the figure.
15281537
1529- subroutine showfig (me , pyfile , istat )
1538+ subroutine showfig (me , pyfile , istat , python )
15301539
15311540 class(pyplot), intent (inout ) :: me ! ! pyplot handler
15321541 character (len=* ), intent (in ), optional :: pyfile ! ! name of the Python script to generate
15331542 integer , intent (out ), optional :: istat ! ! status output (0 means no problems)
1543+ character (len=* ), intent (in ),optional :: python ! ! python executable to use. (by default, this is 'python')
15341544
15351545 if (.not. allocated (me% str)) then
15361546
@@ -1553,7 +1563,7 @@ subroutine showfig(me, pyfile, istat)
15531563 call me% add_str(' plt.show()' )
15541564
15551565 ! run it:
1556- call me% execute(pyfile, istat= istat)
1566+ call me% execute(pyfile, istat= istat, python = python )
15571567
15581568 end if
15591569
0 commit comments