glot
glot copied to clipboard
No image written
Hi again, ok so I tried with pure go 1.9 and checked if a simple test may work... And nothing is written. Maybe I'm doing something wring but, that's the test:
package main
import "github.com/Arafatk/glot"
func main() {
dimensions := 2
// The dimensions supported by the plot
persist := false
debug := true
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")
}
Launching:
go run test.go
cmd> plot "/tmp/go-gnuplot-803798025" title "Simple Circles" with circle
res> 68
cmd> replot "/tmp/go-gnuplot-313721812" title "Simple Lines" with lines
res> 67
cmd> set title "Example Plot"
res> 26
cmd> set xlabel 'X-Axis'
res> 20
cmd> set ylabel 'Y-Axis'
res> 20
cmd> set xrange [-2:18]
res> 19
cmd> set yrange [-2:18]
res> 19
cmd> set terminal png
res> 17
cmd> set output '2.png'
res> 19
cmd> replot
res> 9
[patachou@patrice-desktop tensortest]$ ll 2.png
ls: impossible d'accéder à '2.png': No such file or directory
I'm trying to inderstand, I copy paste the all commands in gnuplot and it works... So what's the problem ?
It seems that now... It works with that patch, but I need to kill gnuplot after a while to let the command release and write png file. That's very strange...
diff --git a/common.go b/common.go
index e57bee1..f6bd9dd 100644
--- a/common.go
+++ b/common.go
@@ -176,10 +176,10 @@ func (plot *Plot) SavePlot(filename string) (err error) {
}
outputFormat := "set terminal " + plot.format
plot.CheckedCmd(outputFormat)
- outputFileCommand := "set output" + "'" + filename + "'"
+ outputFileCommand := "set output" + " '" + filename + "'"
plot.CheckedCmd(outputFileCommand)
- plot.CheckedCmd("replot ")
- return nil
+ plot.CheckedCmd("replot")
+ return
}
// SetFormat function is used to save the plot at this point.
But something strange appears... If I launch
@metal3d I am incredibly sorry for the late reply.
I literally tested the example again and it works fine for me.
If you still face any issues then let me know.
Little improvement : I like glot but when I had take a short after ~20 sec my terminal response me without open gnuplot image. please speedup glot it take ~20-30 sec on average to draw a graph
@ali2210 I am sorry you found the software to be a bit slow.
I think it's probably because of the external dependencies of Glot.
So a lot of this has to be deeply ingrained into the software.
I am super busy with work these days but I would encourage you to try glot and see if you might find something interesting.
Thanks for the comment.
Thankyou This Message send through secure channel called BBM
On Sat, Jan 25, 2020 at 9:01 PM Arafat [email protected] wrote:
@ali2210 https://github.com/ali2210 I am sorry you found the software to be a bit slow. I think it's probably because of the external dependencies of Glot.
So a lot of this has to be deeply ingrained into the software.
I am super busy with work these days but I would encourage you to try glot and see if you might find something interesting.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Arafatk/glot/issues/20?email_source=notifications&email_token=AE45QD727Z4U5N4LU5CFX3TQ7RO4NA5CNFSM4EWK36J2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJ47LDY#issuecomment-578418063, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE45QDY7OAY5JHS6NTLRLJLQ7RO4NANCNFSM4EWK36JQ .
I'm having a problem with mapping 2 dimensional datasets; I'm using go1.16.2 linux/amd64; In general, if I declare an array as:
var PointList [2][]float64
It will silently not plot. Perhaps I'm off-base here, but... ???