コード例 #1
0
ファイル: main.go プロジェクト: sevki/Posts
func testCompression(comrpessions []compressFunction, name string, width, height int) {
	fname := ""
	persist := false
	debug := false

	p, err := gnuplot.NewPlotter(fname, persist, debug)

	if err != nil {
		err_string := fmt.Sprintf("** err: %v\n", err)
		panic(err_string)
	}
	defer p.Close()
	for i := 0; i < len(comrpessions); i++ {
		plot(compress(comrpessions[i], p))

	}
	p.CheckedCmd(fmt.Sprintf("set terminal png medium size %d,%d", width, height))
	p.CheckedCmd("set key right top")
	p.SetXLabel("Compression percentage")
	p.SetYLabel("URL length")

	p.CheckedCmd(fmt.Sprintf("set output '%s.png'", name))
	p.CheckedCmd("replot")
	p.CheckedCmd("q")
}
コード例 #2
0
ファイル: gPHydro.go プロジェクト: jgcarvalho/gPHydro
func Plot(h []float64, hsw []float64) {
	fname := ""
	persist := true
	debug := true

	p, err := gnuplot.NewPlotter(fname, persist, debug)
	if err != nil {
		err_string := fmt.Sprintf("** err: %v\n", err)
		panic(err_string)
	}
	defer p.Close()
	p.SetXLabel("Residue number")
	p.SetYLabel("Hydrophobicity")
	p.CheckedCmd("set yrange [0:1]")
	p.CheckedCmd(fmt.Sprintf("set xrange [1:%d]", len(hsw)))
	// p.PlotX(h, "raw")
	p.SetStyle("lines")
	p.PlotX(hsw, "sw")

	p.CheckedCmd("set terminal pdf")
	p.CheckedCmd("set output 'plot002.pdf'")
	p.CheckedCmd("replot")

	p.CheckedCmd("q")
	return
}
コード例 #3
0
ファイル: main.go プロジェクト: enjenye/beacon
func main() {
	fmt.Println("Hello World")

	// start plot
	plt, err := gnuplot.NewPlotter("", false, false)
	if err != nil {
		return
	}
	defer plt.Close()

	// sample plot
	err = plt.PlotX([]float64{10, 20, 30}, "my title")

}
コード例 #4
0
ファイル: main.go プロジェクト: sevki/Posts
func testHash(hashs []hashFunc, name string, hi, freq, width, height int) {
	fname := ""
	persist := false
	debug := false

	p, err := gnuplot.NewPlotter(fname, persist, debug)
	//	p.SetStyle("lines")
	if err != nil {
		err_string := fmt.Sprintf("** err: %v\n", err)
		panic(err_string)
	}
	defer p.Close()
	for i := 0; i < len(hashs); i++ {
		plot(hash(hashs[i], p, hi, freq))
	}
	p.CheckedCmd(fmt.Sprintf("set terminal png medium size %d,%d", width, height))
	p.CheckedCmd("set key right bottom")
	p.SetXLabel("Collisions")
	p.SetYLabel("Added Items")
	p.CheckedCmd(fmt.Sprintf("set output '%s.png'", name))
	p.CheckedCmd("replot")
	p.CheckedCmd("q")
}