arafatkatze / glot

Glot is a plotting library for Golang built on top of gnuplot.
MIT License
398 stars 19 forks source link

Consider plotXY writing binary file format #22

Open ericjster opened 5 years ago

ericjster commented 5 years ago

Consider changing Plot.plotXY to write a binary file, for faster execution and less IO in both the go code and gnuplot code.

This is a consideration when plotting millions or tens of millions of points. Most other plotting packages can't handle that size. For term png or gif, 20M points takes about 5 seconds.

Here is an example of a gnuplot command for reading a binary file with an array of struct { x, y float32 }: plot '/tmp/gnuplotdata.bin' binary format='%float32%float32' using 1:2

Here is a gist for writing a binary file, using memory mapped IO. It takes about 200 ms for 20M points. https://gist.github.com/ericjster/eea32820660e26b16174fadd4034dd9d