Graphing libraries in golang

3,222 views
Skip to first unread message

Vikram Rawat

unread,
Sep 27, 2017, 11:05:36 AM9/27/17
to golang-nuts
I come from an R background and I am not able to find one single decent not too fancy but a decent graphing library that's good enough to work.

Can you please suggest any library that is good enough for production level plots. Visualisation is the need of today. I don't believe that it doesn't have any but I was not able to search any good one.

Please do reply

Volker Dobler

unread,
Sep 27, 2017, 11:54:46 AM9/27/17
to golang-nuts
One from https://awesome-go.com/#science-and-data-analysis
probably should fit your needs. Or try looking for R bindings and
run your plots through R.

V.

Dan Kortschak

unread,
Sep 27, 2017, 8:35:49 PM9/27/17
to Volker Dobler, golang-nuts
On Wed, 2017-09-27 at 08:54 -0700, Volker Dobler wrote:
> One from https://awesome-go.com/#science-and-data-analysis
> probably should fit your needs. Or try looking for R bindings and
> run your plots through R.


https://godoc.org/gonum.org/v1/plot for the first and https://godoc.org/github.com/kortschak/arrgh for the second.

Rich

unread,
Sep 28, 2017, 8:21:18 AM9/28/17
to golang-nuts
Not sure if this applies but I did some graphing using this: https://godoc.org/github.com/ajstarks/svgo  

Jan Mercl

unread,
Sep 28, 2017, 8:25:27 AM9/28/17
to Vikram Rawat, golang-nuts
On Wed, Sep 27, 2017 at 5:05 PM Vikram Rawat <vikram...@gmail.com> wrote:


--

-j

Vikram Rawat

unread,
Sep 29, 2017, 1:42:50 AM9/29/17
to golang-nuts
By graphing I actually meant data visualization libraries
SVGO would be so hard to pass a data to and design even the basic and simple BARCHART

other ones don't have enough documentation to understand how it works.

and The reason I am trying GO is that R is slow. There is no point in calling R from Go.


So is there any package that is implemented in base GO with the speed of GO and worth learning.

Egon

unread,
Sep 29, 2017, 1:47:13 AM9/29/17
to golang-nuts


On Friday, 29 September 2017 08:42:50 UTC+3, Vikram Rawat wrote:
By graphing I actually meant data visualization libraries
SVGO would be so hard to pass a data to and design even the basic and simple BARCHART

other ones don't have enough documentation to understand how it works.

Sebastien Binet

unread,
Sep 29, 2017, 2:05:37 AM9/29/17
to Vikram Rawat, golang-nuts
On Wed, Sep 27, 2017 at 5:05 PM, Vikram Rawat <vikram...@gmail.com> wrote:
I come from an R background and I am not able to find one single decent not too fancy but a decent graphing library that's good enough to work.

Can you please suggest any library that is good enough for production level plots. Visualisation is the need of today. I don't believe that it doesn't have any but I was not able to search any good one.

what kind of plots do you want to do?
what kind of use do you plan to make of them?

is it for paper publication?
for monitoring?

here are some pointers about my library that (under the hood) uses "gonum/plot":


and here is an example on how to use "gonum/plot" as a monitoring web service:

if you find that gonum/plot is too complicated to use, I'd be very interested in finding out what exactly are the sharp edges (so we can improve.)

constructive feedback is always welcomed!

-s

Vikram Rawat

unread,
Sep 29, 2017, 2:49:35 AM9/29/17
to golang-nuts
Thanks for your reply. Library seems promising. but when I run it , this errors out



cannot find package "bitbucket.org/zombiezen/gopdf/pdf" in any of:
C:\Go\src\bitbucket.org\zombiezen\gopdf\pdf (from $GOROOT)
C:\Projects\Go\src\bitbucket.org\zombiezen\gopdf\pdf (from $GOPATH)



when I try go get on these packages they don't work either.

C:\Projects\Go\src>go get bitbucket.org/zombiezen/gopdf/pdf
go: missing Mercurial command. See https://golang.org/s/gogetcmd
package bitbucket.org/zombiezen/gopdf/pdf: exec: "hg": executable file not found in %PATH%
 
 
I saw a talk on some youtube regarding go in data science. I learned go 2 months ago but now I feel like it's an entirely different beast. look I am just trying to learn GOLANG so that when I need to build something may be after 5 to 10 months I would be comfirtable working with it. So Right now I don't have a use case scnario. I am just trying to learn the language.


But there are a lot of improvements needed like

1. 49 lines of code just to create a flat basic line chart for random numbers. and that's when I haven't even got my data in from the database or did some background coloring.
2. Loops are not good while creating graphs you know them I don't I can miss one and mess it up entirely. With loops, I would never be sure if I have created the right graph. Loops should just run in the background not for me to see or create.
3. The syntax just doesn't feel intuitive. I feel like nobody would be able to predict the next command in the sequence. You must know now there is a grammar of graphics. it's used in ggplot2, ggvis, vega, vega-lite, and many python packages as well.
4. Analysts don't care about speed (maybe a bit) but data. What they do care about is their data code should be easy else your mind will be occupied by typing and thinking code when it should be thinking about data.


today I just feel like golang doesn't have ploting libraries they never thought it was necessary but straight away starting comparing it to python.

but can you please tell me how to run those examples. I am not able to run it. what am I doing wrong.

Dan Kortschak

unread,
Sep 29, 2017, 3:11:55 AM9/29/17
to Vikram Rawat, golang-nuts
To get bitbucket.org/zombiezen/gopdf/... to install, you will need to
install mercurial.

Sebastien Binet

unread,
Sep 29, 2017, 3:15:06 AM9/29/17
to Vikram Rawat, golang-nuts
Vikram,



On Sep 29, 2017 8:49 AM, "Vikram Rawat" <vikram...@gmail.com> wrote:
Thanks for your reply. Library seems promising. but when I run it , this errors out



cannot find package "bitbucket.org/zombiezen/gopdf/pdf" in any of:
C:\Go\src\bitbucket.org\zombiezen\gopdf\pdf (from $GOROOT)
C:\Projects\Go\src\bitbucket.org\zombiezen\gopdf\pdf (from $GOPATH)



when I try go get on these packages they don't work either.

C:\Projects\Go\src>go get bitbucket.org/zombiezen/gopdf/pdf
go: missing Mercurial command. See https://golang.org/s/gogetcmd
package bitbucket.org/zombiezen/gopdf/pdf: exec: "hg": executable file not found in %PATH%
 

You need to install mercurial to retrieve the repository from bitbucket.

We may at some point drop this dependency and use one from GitHub (so there shouldn't be anymore the need to get mercurial first...)

 
I saw a talk on some youtube regarding go in data science. I learned go 2 months ago but now I feel like it's an entirely different beast. look I am just trying to learn GOLANG so that when I need to build something may be after 5 to 10 months I would be comfirtable working with it. So Right now I don't have a use case scnario. I am just trying to learn the language.


But there are a lot of improvements needed like

1. 49 lines of code just to create a flat basic line chart for random numbers. and that's when I haven't even got my data in from the database or did some background coloring.
2. Loops are not good while creating graphs you know them I don't I can miss one and mess it up entirely. With loops, I would never be sure if I have created the right graph. Loops should just run in the background not for me to see or create.
3. The syntax just doesn't feel intuitive. I feel like nobody would be able to predict the next command in the sequence. You must know now there is a grammar of graphics. it's used in ggplot2, ggvis, vega, vega-lite, and many python packages as well.
4. Analysts don't care about speed (maybe a bit) but data. What they do care about is their data code should be easy else your mind will be occupied by typing and thinking code when it should be thinking about data.

Data is important, indeed, and knowing how you present it too :)

If you prefer a grammar of graphics type of library, there's this one as well:



today I just feel like golang doesn't have ploting libraries they never thought it was necessary but straight away starting comparing it to python.

but can you please tell me how to run those examples. I am not able to run it. what am I doing wrong.

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Vikram Rawat

unread,
Sep 29, 2017, 4:33:36 AM9/29/17
to golang-nuts
thanks a lot for your reply sebestian. 

You certainly are a good man and I have high hopes for your library too...

But before coming to Mailing list I check almost all of them and I didn't find anyone useful. The  https://github.com/aclements/go-gg package is not useful at all. Because there is noone using it and the last commit was 6 months ago. It's more likely that the developer gave up on it. It's a common norm in open source don't use a new package which has a very old commit.



I have checked most of them. I came here seeking for a like-minded people who had created any graphs in go for actual projects. I didn't find any.

Hope you understand it. Good luck for your package I hope it can be useful in future. Just as a word of advice link it with GOTA. then it can be more intuitive for people from analytical background.


Sebastien Binet

unread,
Sep 29, 2017, 5:23:34 AM9/29/17
to Vikram Rawat, golang-nuts
On Fri, Sep 29, 2017 at 10:33 AM, Vikram Rawat <vikram...@gmail.com> wrote:
thanks a lot for your reply sebestian. 

You certainly are a good man and I have high hopes for your library too...

But before coming to Mailing list I check almost all of them and I didn't find anyone useful. The  https://github.com/aclements/go-gg package is not useful at all. Because there is noone using it and the last commit was 6 months ago. It's more likely that the developer gave up on it. It's a common norm in open source don't use a new package which has a very old commit.





I have checked most of them. I came here seeking for a like-minded people who had created any graphs in go for actual projects. I didn't find any.

Hope you understand it. Good luck for your package I hope it can be useful in future. Just as a word of advice link it with GOTA. then it can be more intuitive for people from analytical background.

I don't think gonum/plot nor go-hep/hplot should depend on GOTA.
Nor do I think that GOTA should import any of those.

But, probably there is some space for another 3rd party package that import both (GOTA, or your prefered data storage access/mangler package, and gonum/plot or hplot) and then exposes an easy to use interface for quick throw-away scripts.

-s

Daniel Whitenack

unread,
Sep 29, 2017, 6:41:55 AM9/29/17
to golang-nuts
Hi Vikram,

Great questions. In general for data related things, this is a great place to start looking for resources: https://github.com/gopherdata/resources/blob/master/tooling/README.md. that is a curated list that is kept up to date.

I use https://github.com/gonum/plot quite a bit and found that it has a similar interface to that of Matlab for plotting. The links that Sebastian gave from ghep are also great. Between those, bar, line, histogram, box, etc. plots are quick to generate.

If you want something super fancy you can of course drive JS visualizations (like D3) from Go.

Just let me know how I can help!

Daniel

ajstarks

unread,
Sep 29, 2017, 11:59:24 AM9/29/17
to golang-nuts
SVGo is library for SVG generation, but others (some cited in this thread), have used it as a basis for building graphics and visualizations.  See: [1]  for examples (including how to interface to data, there's even a barchart [2]  example :)

Reply all
Reply to author
Forward
0 new messages