Re: [go-nuts] gonum plot : font error
@Roland : I saw this change too, removing the error variable fix the problem :) Le mardi 18 mai 2021 à 12:44:40 UTC+2, rol...@gmail.com a écrit : > Hello, > > applying Carlas's solution I got a failure in line 20 since plot.New() > returns a pointer but no pointer, error pair. > > Only after changing usage of New() I got the scatter-demo running. May be > error message can be enhanced :-) > > scatter-demo]$ go build > > # scatter-demo > ./main.go:20:9: assignment mismatch: 2 variables but plot.New returns 1 > values > > 20 p := plot.New() 21 if p == nil { 22 panic("Plotter cannot > be created") 23 } > > > BR, > Roland > > > Am Mo., 17. Mai 2021 um 16:38 Uhr schrieb Fred : > >> Thanks Carla and Sébastien for your quick answer ! >> >> Carla your solution works, when I use modules I do not have font errors. >> >> What is strange is that I was not using modules in any computer to try >> this example and it was working in one an not the other :) >> >> Le lundi 17 mai 2021 à 15:10:55 UTC+2, Sebastien Binet a écrit : >> >>> Salut Fred, >>> >>> On Mon May 17, 2021 at 14:11 CET, Fred wrote: >>> > Hi, >>> > I have 2 computers with Linux Manjaro and go version 1.16.3. >>> > The same scatter plot >>> > <https://gist.github.com/sbinet/602522b7399ead414e279e2261d81095> >>> works >>> > on >>> > one computer and produces on the other these already known errors : >>> > <https://groups.google.com/g/gonum-dev/c/a8sC1fzV3Mo> >>> > >>> > # gonum.org/v1/plot/text >>> > /home/fred/GO/src/gonum.org/v1/plot/text/latex.go:153:3: cannot use >>> > hdlr.Fonts.Lookup(rm, fnt.Size).Face (type *sfnt.Font) as type >>> > *truetype.Font in field value >>> > /home/fred/GO/src/gonum.org/v1/plot/text/latex.go:154:3: cannot use >>> > hdlr.Fonts.Lookup(rm, fnt.Size).Face (type *sfnt.Font) as type >>> > *truetype.Font in field value >>> > /home/fred/GO/src/gonum.org/v1/plot/text/latex.go:155:3: cannot use >>> > hdlr.Fonts.Lookup(it, fnt.Size).Face (type *sfnt.Font) as type >>> > *truetype.Font in field value >>> > /home/fred/GO/src/gonum.org/v1/plot/text/latex.go:156:3: cannot use >>> > hdlr.Fonts.Lookup(bf, fnt.Size).Face (type *sfnt.Font) as type >>> > *truetype.Font in field value >>> > /home/fred/GO/src/gonum.org/v1/plot/text/latex.go:157:3: cannot use >>> > hdlr.Fonts.Lookup(bfit, fnt.Size).Face (type *sfnt.Font) as type >>> > *truetype.Font in field value >>> > /home/fred/GO/src/gonum.org/v1/plot/text/latex.go:221:3: cannot use >>> > op.Glyph.Font (type *truetype.Font) as type *sfnt.Font in field value >>> >>> this should indeed be fixed w/ gonum/pl...@v0.9.0. >>> >>> > >>> > an update does not fix the error. >>> > >>> > go get -u gonum.org/v1/plot/... >>> > # cd /home/fred/GO/src/github.com/go-latex/latex; git pull --ff-only >>> > Votre information de configuration indique de fusionner avec la >>> > référence >>> > 'refs/heads/master' >>> > du serveur distant, mais cette référence n'a pas été récupérée. >>> > package github.com/go-latex/latex/drawtex: exit status 1 >>> >>> this error may come from the fact that go-latex/latex is now using >>> 'main' as its main branch in lieu of 'master'. >>> >>> hth, >>> -s >>> >> -- >> You received this message because you are subscribed to the Google Groups >> "golang-nuts" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to golang-nuts...@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/golang-nuts/efb3fb0c-cbeb-4815-a0d9-ee7a4b638ad8n%40googlegroups.com >> >> <https://groups.google.com/d/msgid/golang-nuts/efb3fb0c-cbeb-4815-a0d9-ee7a4b638ad8n%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/9a0b204c-d17b-47a3-a3b9-cad3dc91bbd0n%40googlegroups.com.
Re: [go-nuts] gonum plot : font error
Thanks Carla and Sébastien for your quick answer ! Carla your solution works, when I use modules I do not have font errors. What is strange is that I was not using modules in any computer to try this example and it was working in one an not the other :) Le lundi 17 mai 2021 à 15:10:55 UTC+2, Sebastien Binet a écrit : > Salut Fred, > > On Mon May 17, 2021 at 14:11 CET, Fred wrote: > > Hi, > > I have 2 computers with Linux Manjaro and go version 1.16.3. > > The same scatter plot > > <https://gist.github.com/sbinet/602522b7399ead414e279e2261d81095> works > > on > > one computer and produces on the other these already known errors : > > <https://groups.google.com/g/gonum-dev/c/a8sC1fzV3Mo> > > > > # gonum.org/v1/plot/text > > /home/fred/GO/src/gonum.org/v1/plot/text/latex.go:153:3: cannot use > > hdlr.Fonts.Lookup(rm, fnt.Size).Face (type *sfnt.Font) as type > > *truetype.Font in field value > > /home/fred/GO/src/gonum.org/v1/plot/text/latex.go:154:3: cannot use > > hdlr.Fonts.Lookup(rm, fnt.Size).Face (type *sfnt.Font) as type > > *truetype.Font in field value > > /home/fred/GO/src/gonum.org/v1/plot/text/latex.go:155:3: cannot use > > hdlr.Fonts.Lookup(it, fnt.Size).Face (type *sfnt.Font) as type > > *truetype.Font in field value > > /home/fred/GO/src/gonum.org/v1/plot/text/latex.go:156:3: cannot use > > hdlr.Fonts.Lookup(bf, fnt.Size).Face (type *sfnt.Font) as type > > *truetype.Font in field value > > /home/fred/GO/src/gonum.org/v1/plot/text/latex.go:157:3: cannot use > > hdlr.Fonts.Lookup(bfit, fnt.Size).Face (type *sfnt.Font) as type > > *truetype.Font in field value > > /home/fred/GO/src/gonum.org/v1/plot/text/latex.go:221:3: cannot use > > op.Glyph.Font (type *truetype.Font) as type *sfnt.Font in field value > > this should indeed be fixed w/ gonum/pl...@v0.9.0. > > > > > an update does not fix the error. > > > > go get -u gonum.org/v1/plot/... > > # cd /home/fred/GO/src/github.com/go-latex/latex; git pull --ff-only > > Votre information de configuration indique de fusionner avec la > > référence > > 'refs/heads/master' > > du serveur distant, mais cette référence n'a pas été récupérée. > > package github.com/go-latex/latex/drawtex: exit status 1 > > this error may come from the fact that go-latex/latex is now using > 'main' as its main branch in lieu of 'master'. > > hth, > -s > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/efb3fb0c-cbeb-4815-a0d9-ee7a4b638ad8n%40googlegroups.com.
[go-nuts] gonum plot : font error
Hi, I have 2 computers with Linux Manjaro and go version 1.16.3. The same scatter plot <https://gist.github.com/sbinet/602522b7399ead414e279e2261d81095> works on one computer and produces on the other these already known errors : <https://groups.google.com/g/gonum-dev/c/a8sC1fzV3Mo> # gonum.org/v1/plot/text /home/fred/GO/src/gonum.org/v1/plot/text/latex.go:153:3: cannot use hdlr.Fonts.Lookup(rm, fnt.Size).Face (type *sfnt.Font) as type *truetype.Font in field value /home/fred/GO/src/gonum.org/v1/plot/text/latex.go:154:3: cannot use hdlr.Fonts.Lookup(rm, fnt.Size).Face (type *sfnt.Font) as type *truetype.Font in field value /home/fred/GO/src/gonum.org/v1/plot/text/latex.go:155:3: cannot use hdlr.Fonts.Lookup(it, fnt.Size).Face (type *sfnt.Font) as type *truetype.Font in field value /home/fred/GO/src/gonum.org/v1/plot/text/latex.go:156:3: cannot use hdlr.Fonts.Lookup(bf, fnt.Size).Face (type *sfnt.Font) as type *truetype.Font in field value /home/fred/GO/src/gonum.org/v1/plot/text/latex.go:157:3: cannot use hdlr.Fonts.Lookup(bfit, fnt.Size).Face (type *sfnt.Font) as type *truetype.Font in field value /home/fred/GO/src/gonum.org/v1/plot/text/latex.go:221:3: cannot use op.Glyph.Font (type *truetype.Font) as type *sfnt.Font in field value an update does not fix the error. go get -u gonum.org/v1/plot/... # cd /home/fred/GO/src/github.com/go-latex/latex; git pull --ff-only Votre information de configuration indique de fusionner avec la référence 'refs/heads/master' du serveur distant, mais cette référence n'a pas été récupérée. package github.com/go-latex/latex/drawtex: exit status 1 the go/src/gonum.org/v1/plot/font directory is the same on both computers. Do I need to install some missing fonts ? Thanks in advance, Fred -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/826ba085-1506-4f07-a44e-c334fd7198bdn%40googlegroups.com.
[go-nuts] Re: Calculation of the combinations between an unlimited number of slices
@Howard thank you very much for this nice analysis of my code ! -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[go-nuts] Re: Calculation of the combinations between an unlimited number of slices
Thanks @Jake Le jeudi 7 décembre 2017 01:01:46 UTC+1, Jake Montgomery a écrit : > > On Monday, December 4, 2017 at 2:56:19 PM UTC-5, Fred wrote: >> >> >> > Perhaps start with Go Slices: usage and internals > <https://blog.golang.org/go-slices-usage-and-internals>, for a more > complete understanding of slice pitfalls. > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[go-nuts] Re: Calculation of the combinations between an unlimited number of slices
it seems that making a copy of the temp var, replacing : temp = append(temp, c1) by : temp = append(temp, append([]int{}, c1...)) helps, but still unclear for me why the problem was only visible on slice 4... -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[go-nuts] Calculation of the combinations between an unlimited number of slices
Hi ! I have made a recursive algorithm to compute all the combinations between an unlimited number of slices. The algorithm does good results for 2 and 3 slices. For example with 3 slices a,b,c : a := []int{1,2} b := []int{3,4} c := []int{5,6} final comb [[1 3 5] [1 3 6] [1 4 5] [1 4 6] [2 3 5] [2 3 6] [2 4 5] [2 4 6]] // good , but I have a strange bug with 4 slices : only the last element of the slice 4 is recorded. a := []int{1,2} b := []int{3,4} c := []int{5,6} d := []int{7,8,9} final comb [[1 3 5 9] [1 3 5 9] [1 3 5 9] [1 3 6 9] [1 3 6 9] [1 3 6 9] [1 4 5 9] [1 4 5 9] [1 4 5 9] [1 4 6 9] [1 4 6 9] [1 4 6 9] [2 3 5 9] [2 3 5 9] [2 3 5 9] [2 3 6 9] [2 3 6 9] [2 3 6 9] [2 4 5 9] [2 4 5 9] [2 4 5 9] [2 4 6 9] [2 4 6 9] [2 4 6 9]] // bad result, the combination [1 3 5 7] and [1 3 5 8] are missing The error occurs between these 2 steps c1 := append(c, s) temp = append(temp, c1) when c1 is appended to temp, i,j,k = 2, 0, 0 - temp = [[1 3 5 7]] [[1 3 5 7]] is replaced by [1 3 5 8] inside the loop and [1 3 5 7] combination is lost ! i,j,k =2, 0, 1 - temp = [[1 3 5 8] [1 3 5 8]] i,j,k =2, 0, 2 - temp = [[1 3 5 9] [1 3 5 9] [1 3 5 9]] Here is the algorithm. With 5 slices the results are good except for the slice 4 combinations. I did not found the bug, if you see it, thank you for your help ! package main import ( "fmt" ) func main() { a := []int{1,2} b := []int{3,4} c := []int{5,6} d := []int{7,8,9} //e := []int{1,2} seq := [][]int{a, b, c, d} // slice to combine with comb [[b1 b2] [c1 c2 c3]] fmt.Println("final comb ", combIntSlices(seq) ) } // function to build the combinations func combIntSlices(seq [][]int) (out [][]int) { // fill combSeq with the first slice of seq var combSeq [][]int // combSeq is the initial [][]int, for example [[1] [2] [3]] for _, i := range seq[0] { combSeq = append(combSeq, []int{i}) } seq = seq[1:] // seq is the [][]slice to combine with combSeq [[4 5] [6 7 8]] fmt.Println(seq, len(seq)) // rec recursive funtion var rec func(int, [][]int, [][]int) rec = func(i int, seq, combSeq [][]int) { var temp [][]int // temporary slice to append combinations last := len(seq) - 1 fmt.Println(combSeq, "-", seq) for j, c := range combSeq { // for each slice in combSeq slice for k, s := range seq[i] { // append each element of the slice i in seq c1 := append(c, s) temp = append(temp, c1) fmt.Println(i,j,k, "- temp =", temp, " c=", c) } combSeq = temp // at this step temp has recorded one round of combination } if i == last { // if the length of seq is reached, the solution is returned out = combSeq return } else { rec(i+1, seq, combSeq) // if the length of seq is not reached, rec is called to perform another step of combinations } } rec(0, seq, combSeq) // start the first step of combinations return out } -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. combin-5.go Description: Binary data