Skip to content

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

Notifications You must be signed in to change notification settings

go-wyvern/gplot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

========

Go Report Card Language GoDoc

Tutorials

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 ./...
  • Build tutorials and run.
    • cd tutorial/xxx
    • gop run .

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)

About

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

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published