Вопрос

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.

Это было полезно?

Решение

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)

Другие советы

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()    
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top