@@ -1336,16 +1336,18 @@ end subroutine matrix_to_string
1336
1336
! If user specifies a Python file name, then the file is kept, otherwise
1337
1337
! a temporary filename is used, and the file is deleted after it is used.
1338
1338
1339
- subroutine execute (me , pyfile , istat )
1339
+ subroutine execute (me , pyfile , istat , python )
1340
1340
1341
1341
class(pyplot), intent (inout ) :: me ! ! pytplot handler
1342
1342
character (len=* ), intent (in ), optional :: pyfile ! ! name of the python script to generate
1343
1343
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')
1344
1345
1345
1346
integer :: iunit ! ! IO unit
1346
1347
character (len= :), allocatable :: file ! ! file name
1347
1348
logical :: scratch ! ! if a scratch file is to be used
1348
1349
integer :: iostat ! ! open/close status code
1350
+ character (len= :), allocatable :: python_ ! ! python executable to use
1349
1351
1350
1352
if (allocated (me% str)) then
1351
1353
@@ -1379,12 +1381,18 @@ subroutine execute(me, pyfile, istat)
1379
1381
write (error_unit,' (A)' ) ' Error closing file: ' // trim (file)
1380
1382
else
1381
1383
1384
+ if (present (python)) then
1385
+ python_ = trim (python)
1386
+ else
1387
+ python_ = python_exe
1388
+ end if
1389
+
1382
1390
! run the file using python:
1383
1391
if (index (file,' ' )>0 ) then
1384
1392
! space in path, probably should enclose in quotes
1385
- call execute_command_line(python_exe // ' "' // file// ' "' )
1393
+ call execute_command_line(python_ // ' "' // file// ' "' )
1386
1394
else
1387
- call execute_command_line(python_exe // ' ' // file)
1395
+ call execute_command_line(python_ // ' ' // file)
1388
1396
end if
1389
1397
1390
1398
if (scratch) then
@@ -1466,7 +1474,7 @@ end subroutine finish_ops
1466
1474
! * modified: Johannes Rieke 6/16/2017
1467
1475
! * modified: Jacob Williams 6/16/2017
1468
1476
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 )
1470
1478
1471
1479
class(pyplot), intent (inout ) :: me ! ! pyplot handler
1472
1480
character (len=* ), intent (in ) :: figfile ! ! file name for the figure
@@ -1478,6 +1486,7 @@ subroutine savefig(me, figfile, pyfile, dpi, transparent, facecolor, edgecolor,
1478
1486
character (len=* ), intent (in ), optional :: edgecolor ! ! the colors of the figure rectangle
1479
1487
character (len=* ), intent (in ), optional :: orientation ! ! 'landscape' or 'portrait'
1480
1488
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')
1481
1490
1482
1491
character (len= :),allocatable :: tmp ! ! for building the `savefig` arguments.
1483
1492
@@ -1510,7 +1519,7 @@ subroutine savefig(me, figfile, pyfile, dpi, transparent, facecolor, edgecolor,
1510
1519
deallocate (tmp)
1511
1520
1512
1521
! run it:
1513
- call me% execute(pyfile, istat= istat)
1522
+ call me% execute(pyfile, istat= istat, python = python )
1514
1523
1515
1524
else
1516
1525
if (present (istat)) istat = - 1
@@ -1526,11 +1535,12 @@ end subroutine savefig
1526
1535
!
1527
1536
! Shows the figure.
1528
1537
1529
- subroutine showfig (me , pyfile , istat )
1538
+ subroutine showfig (me , pyfile , istat , python )
1530
1539
1531
1540
class(pyplot), intent (inout ) :: me ! ! pyplot handler
1532
1541
character (len=* ), intent (in ), optional :: pyfile ! ! name of the Python script to generate
1533
1542
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')
1534
1544
1535
1545
if (.not. allocated (me% str)) then
1536
1546
@@ -1553,7 +1563,7 @@ subroutine showfig(me, pyfile, istat)
1553
1563
call me% add_str(' plt.show()' )
1554
1564
1555
1565
! run it:
1556
- call me% execute(pyfile, istat= istat)
1566
+ call me% execute(pyfile, istat= istat, python = python )
1557
1567
1558
1568
end if
1559
1569
0 commit comments