"Draw a graph in the programming language Julia" I succeeded in moving the sample for the time being, but the data created by my own program (in Julia language) I decided to find out how to draw a graph using. I made a graph of a simple function and a sample of arrow animation. As usual, the calculation result obtained by Julia is displayed as a graph in PyQtGraph. (Please create an environment and move it)
Note: For the environment construction, refer to "Drawing a graph in the programming language Julia".
jl:ArrowSample.jl(C:\julia-0.2.1-win32\Save to bin)
# -*- coding: utf-8 -*- using PyCall @pyimport ArrowSample x = [ -10 : 0.1 : 10 ] y1 = [ x[i]*x[i] for i=1:length(x) ] y2 = [ x[i]*2+50 for i=1:length(x) ] ArrowSample.graph_run(x, y1, y2)
python:ArrowSample.py(C:\julia-0.2.1-win32\Save to bin)
# -*- coding: utf-8 -*- from pyqtgraph.Qt import QtGui, QtCore import pyqtgraph as pg def graph_run(plot_data_x, plot_data_y1, plot_data_y2): app = QtGui.QApplication() win = pg.GraphicsWindow(title=u"Julia+PyQtGraph sample") win.resize(400,300) # Enable antialiasing for prettier plots pg.setConfigOptions(antialias=True) p1 = win.addPlot(title=u"Arrow animation") c1 = p1.plot(x=plot_data_x, y=plot_data_y1) c2 = p1.plot(x=plot_data_x, y=plot_data_y2) p1.showGrid(x=True, y=True) a1 = pg.CurveArrow(c1) p1.addItem(a1) anim1 = a1.makeAnimation(loop=-1) anim1.start() a2 = pg.CurveArrow(c2) p1.addItem(a2) anim2 = a2.makeAnimation(loop=-1) anim2.start() app.exec_()