Beispiel #1
0
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")
}
Beispiel #2
0
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
}
Beispiel #3
0
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")

}
Beispiel #4
0
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")
}