gplot - A Go+ drawing Engine with a syntax similar to matlab
========
How to run gplot tutorials?
- Download Go+ and build it. See https://github.com/goplus/gop#how-to-build. (Depends on Go+ ver 1.1 or higher)
- Download gplot and build it.
- git clone
git@github.com:go-wyvern/gplot.git
- cd gplot
- go install -v ./...
- git clone
- Build tutorials and run.
- cd tutorial/xxx
- gop run .
Through this example you can learn how to simply draw a line graph.
Here are some codes in index.plot:
x := linspace(0, 2*pi, 20)
y := [sin(i) for i <- x]
plot(x, y)
In this example, we can learn how to draw multiple lines into one figure.
Here are all the codes of index.plot:
x := linspace(0, 2*pi, 20)
y1 := [sin(i) for i <- x]
y2 := [cos(i) for i <- x]
plot(x, y1, x, y2)
Through this example, we can learn how to add names to axis.
Here are some codes in index.plot:
x := linspace(0, 2*pi, 20)
y := [sin(i) for i <- x]
xlabel("x")
ylabel("sin(x)")
plot(x, y)
Through this example, we can learn how to draw multiple axis into a figure.
Here are some codes in index.plot:
x := linspace(0, 2*pi, 20)
y1 := [sin(i) for i <- x]
y2 := [cos(i) for i <- x]
y3 := [i*i for i <- x]
y4 := [-1*i*i for i <- x]
subplot(2,2,1)
plot(x, y1)
subplot(2,2,2)
plot(x, y2)
subplot(2,2,3)
plot(x, y3)
subplot(2,2,4)
plot(x, y4)
Through this example, we can learn how to add legend to the axis.
Here are some codes in index.plot:
x := linspace(0, 2*pi, 20)
y1 := [sin(i) for i <- x]
y2 := [cos(i) for i <- x]
legend("sin(x)", "cos(x)")
plot(x, y1, x ,y2)
Through this example, we can learn how to add title to the axis.
Here are some codes in index.plot:
x := linspace(0, 2*pi, 20)
y := [sin(i) for i <- x]
title("this is title")
plot(x, y)
Through this example, we can learn how to draw a bar
Here are some codes in index.plot:
a := [1, 3, 5, 7, 11]
b := [1, 3, 5, 7, 11]
c := [1, 3, 5, 7, 11]
nominalX("s1", "s2", "s3", "s4")
bar(a, b, c)