Skip to content

Latest commit

 

History

History
141 lines (96 loc) · 3.08 KB

README.md

File metadata and controls

141 lines (96 loc) · 3.08 KB

gplot - A Go+ drawing Engine with a syntax similar to matlab

========

Go Report Card Language GoDoc

Tutorials

How to run gplot tutorials?

tutorial/01-single-plot

Screen Shot1

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)

tutorial/02-multi-plot

Screen Shot1

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)

tutorial/03-label-plot

Screen Shot1

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)

tutorial/04-subplot

Screen Shot1

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)

tutorial/05-legend

Screen Shot1

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)

tutorial/06-title

Screen Shot1

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)

tutorial/07-bar

Screen Shot1

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)