Question

I know that I can plot my python-generated data by matplotlib. The reason why I want to plot my data using Scilab is keeping plotted figure the same style. Because I already have plotted many figures using Scilab.

Should I use subprocess.Popen to run a scilab script? Is there a better way than this.

Was it helpful?

Solution

The sciscipy python package seems to provide interface to Scilab features inside Python.

An example for you to assess if this is what you want:

from scilab import Scilab
sci = Scilab()
x = sci.rand(20, 20)
y = x*x.transpose()
y_inv = sci.inv(y)

OTHER TIPS

You can make your python script interact with your scilab plotting script through sockets. Here's how you send data from python:

import socket                                              
import sys                                                 

host = socket.gethostname()                                
port = 59981                                               
try:                                                       
    soc = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    soc.bind((host, port))                                 
except socket.error:                                       
    print "Unable to setup"                                

soc.listen(5)                                              
while True:                                                
    conn, addr = soc.accept()                              
    conn.send("data")                                      
    conn.close()    
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top