Skip to content

Instantly share code, notes, and snippets.

@arafatkatze
Last active August 23, 2017 19:43
Show Gist options
  • Save arafatkatze/819cbaf7f5e8892729bf7701e8d12ec1 to your computer and use it in GitHub Desktop.
Save arafatkatze/819cbaf7f5e8892729bf7701e8d12ec1 to your computer and use it in GitHub Desktop.
package main
import "github.com/Arafatk/glot"
func main() {
dimensions := 2
// The dimensions supported by the plot
persist := false
debug := false
plot, _ := glot.NewPlot(dimensions, persist, debug)
pointGroupName := "Simple Circles"
style := "circle"
points := [][]float64{{7, 3, 13, 5.6, 11.1}, {12, 13, 11, 1, 7}}
// Adding a point group
plot.AddPointGroup(pointGroupName, style, points)
pointGroupName = "Simple Lines"
style = "lines"
points = [][]float64{{7, 3, 3, 5.6, 5.6, 7, 7, 9, 13, 13, 9, 9}, {10, 10, 4, 4, 5.4, 5.4, 4, 4, 4, 10, 10, 4}}
plot.AddPointGroup(pointGroupName, style, points)
// A plot type used to make points/ curves and customize and save them as an image.
plot.SetTitle("Example Plot")
// Optional: Setting the title of the plot
plot.SetXLabel("X-Axis")
plot.SetYLabel("Y-Axis")
// Optional: Setting label for X and Y axis
plot.SetXrange(-2, 18)
plot.SetYrange(-2, 18)
// Optional: Setting axis ranges
plot.SavePlot("2.png")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment