"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 modified the sample source to make the source at the end of the sentence (when saving, please save with UTF-8 character code).
I set an array with 8 elements in a variable called data
in the part wheredata = [1, 2, 3, 4, 5, 10, 20, 5]
.
After that, you can pass an array to the first argument of the plot method like p1.plot (data)
, p2.plot (data,…)
, p3.plot (data,…)
. It seems. Basically this may be OK!
basic-plot.jl
using PySide
reload(Pkg.dir("PySide", "src", "pyqtgraph.jl"))
using PyQtGraph
w = Widget()
lyt = VBoxLayout(w)
setLayout(w, lyt)
win = GraphicsLayoutWidget(w)
addWidget(lyt, win)
set_size(w, 800, 200)
raise(w)
data = [1, 2, 3, 4, 5, 10, 20, 5]
p1 = addPlot(win, title="Basic array plotting (Basic)")
p1.plot(data)
p2 = addPlot(win, title="Multiple curves (Multiple)")
p2.plot(data, pen=(255,0,0))
p2.plot(data .+ 5, pen=(0, 255, 0))
p2.plot(data .+ 10, pen=(0,0,255))
p3 = addPlot(win, title="Drawing with points (point)")
p3.plot(data, pen=(200, 200, 200), symbol='f', symbolPen='w', symbolBrush=(255,0,0))
PySide.app[:exec_]()
Recommended Posts