glot icon indicating copy to clipboard operation
glot copied to clipboard

can't set log scale

Open bernardoaraujor opened this issue 6 years ago • 1 comments

here's my function:

func EMLogLog(em elementary.Model){
	tfs := em.TokensNfreqs

	freqs := make([]int, 0)
	is := make([]int, 0)
	for i, tf := range tfs{
		is = append(is, i)
		freqs = append(freqs, tf.Freq)
	}

	dimensions := 2
	// The dimensions supported by the plot
	persist := false
	debug := true
	plot, _ := glot.NewPlot(dimensions, persist, debug)

	pointGroupName := "frequency"
	style := "lines"
	points := [][]int{is, freqs}
	plot.AddPointGroup(pointGroupName, style, points)

	plot.SetTitle(em.Name)

	plot.SetXLabel("Token Rank")
	plot.SetYLabel("Token Freq")

	plot.SetXrange(0, len(is))
	plot.SetYrange(0, freqs[0])

	plot.SetLogscale("x", 10)
	plot.SetLogscale("y", 10)
	//fmt.Println(err)

	plot.SavePlot("plot/plots/" + em.Name + ".png")
}

this is the debug log:

cmd> plot "/tmp/go-gnuplot-360955978" title "frequency" with lines
res> 62
cmd> set title "Exact Match:500-worst-passwords" 
res> 45
cmd> set xlabel 'Token Rank'
res> 24
cmd> set ylabel 'Token Freq'
res> 24
cmd> set xrange [0:339]
res> 19
cmd> set yrange [0:69638]
res> 21
cmd> set logscale x 10
res> 18
cmd> set logscale y 10
res> 18
cmd> set terminal png
res> 17
cmd> set output'plot/plots/Exact Match:500-worst-passwords.png'
res> 59
cmd> replot  
res> 9

Am I doing something wrong?

bernardoaraujor avatar Nov 21 '17 15:11 bernardoaraujor

Do you mind offering some insight into what is happening, or not happening?

szaydel avatar Jan 05 '18 04:01 szaydel