Easy plotting of graphs with Golang

polaris · · 867 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>To understand where I&#39;m coming from, some background! (following paragraph is not overly important to my post, you may skip it if you want to head straight to my actual argument.)</p> <p><em>I&#39;m a physics master student who have been looking for a programming language that have a suitable compromise between speed (~ low level), and easy to use (~ high level). Plus, it should align with my preferred programming style (rather strong typing, modern approaches, object oriented). Languages that I have been looking at in some detail, and rejected, are MatLab, Python, C(++) and Julia (other languages, I have rejected on the surface). And then I found Go. It seems perfect for my preferences! My intention is to use Go to do rather heavy numerical modelling. A key part of such development is to visualise your data easily, at different stages in the program, and during development. In other words, plotting graphs! Languages such as MatLab and Python are really good at this. They have a variety of plotting tools that are all easy to use (i.e. gives clear and professionally looking output with relatively little effort). In particular, Python uses &#34;matplotlib&#34;.</em></p> <p>I would like to suggest that Golang needs a library like Matplotlib! Unfortunately I am not at all in position to take on a project such as porting Matplotlib to Go (I lack both the required time and skill).</p> <p>Is there anyone at Google or in the Golang community that also sees benefits in making Go an excellent language for science? Please give us an easy plotting tool like Matplotlib!</p> <p><a href="http://matplotlib.org/" rel="nofollow">http://matplotlib.org/</a></p> <p>Thoughts? Is this easy, or incredibly hard, to do?</p> <hr/>**评论:**<br/><br/>chewxy: <pre><p>I wrote <a href="https://github.com/chewxy/gorgonia" rel="nofollow">gorgonia</a>, which comes with a tensor package. My typical process is I write stuff and send it to d3js to plot it out, but <a href="https://twitter.com/chewxy/status/808621281260105733" rel="nofollow">lately</a> that has been a no-go for me, so I may be looking to write a version of matplotlib that leverages gonum/plot</p></pre>oh-delay: <pre><p>Gorgonia looks impressive! If you ever decide to take on matplotlib, be sure to return here and tell us about it!</p></pre>0xjnml: <pre><p>Maybe one of these can be of some use for you:</p> <ul> <li><a href="https://github.com/gonum/plot" rel="nofollow">github.com/gonum/plot</a></li> <li><a href="https://github.com/cznic/plot" rel="nofollow">github.com/cznic/plot</a></li> </ul></pre>oh-delay: <pre><p>I have had a quick look at the existing possibilities of plotting with Go. The one that I liked the most so far is this:</p> <p><a href="https://github.com/wcharczuk/go-chart" rel="nofollow">https://github.com/wcharczuk/go-chart</a></p> <p>However, Matplotlib is very commonly used when producing graphs for scientific purposes. Porting that particular library would substantially lower the threshold when switching to Go, for anyone coming from Matlab or Python coding (both very common for scientific purposes). I know it would for me! And I would also feel much safer knowing that all the functionality I am used to from Matlab/Python will be available for me when I&#39;m starting out some new big project in Go. </p></pre>sbinet: <pre><p>what don&#39;t you like about (or what is missing from) gonum/plot?</p></pre>oh-delay: <pre><p>Well, I haven&#39;t used it well enough to comprehensively answer that, but my primary concern was this: <a href="http://i.imgur.com/TNw53KZ.jpg" rel="nofollow">http://i.imgur.com/TNw53KZ.jpg</a></p> <p>EDIT: Also, can you make 3d plots with gonum/plot?</p></pre>sbinet: <pre><p>with a grid, it doesn&#39;t look that bad, does it?</p> <p><a href="https://raw.githubusercontent.com/go-hep/hplot/master/testdata/h1d_plot_golden.png" rel="nofollow">https://raw.githubusercontent.com/go-hep/hplot/master/testdata/h1d_plot_golden.png</a></p> <p>also, this is just the default output, with the default <code>plot.Plot</code> toolkit. building your own isn&#39;t too far fetched.</p> <p>I had a proposal to have such a thing: <a href="https://github.com/sbinet/gonum-plot/blob/c9e6ee6b18f0d9adbefa82edf2521f041a382f79/plotter/testdata/histogram-custom-style_golden.png" rel="nofollow">https://github.com/sbinet/gonum-plot/blob/c9e6ee6b18f0d9adbefa82edf2521f041a382f79/plotter/testdata/histogram-custom-style_golden.png</a></p></pre>sbinet: <pre><p>Nope, no 3D plots per se (except for 2D plots + z encoded as color)</p></pre>sbinet: <pre><p>What kind of plots do you surmise to use or need? 1d? 2D? 3D? Interactive plots?</p> <p>One possible avenue is to leverage github.com/gonum/plot to achieve this.</p> <p>See for example: <a href="https://github.com/go-hep/hplot" rel="nofollow">https://github.com/go-hep/hplot</a></p></pre>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

867 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传