Plot coordinate pairs: Difference between revisions

Content added Content deleted
(Replacing "gnuplot" with "gnuplotlib".)
Line 2,194: Line 2,194:
=={{header|Nim}}==
=={{header|Nim}}==
===Using gnuplot===
===Using gnuplot===
{{libheader|gnuplot.nim}}
{{libheader|gnuplotlib.nim}}
There exists two libraries providing a Nim interface to “gnuplot” (the GNU plotting program), which are named “gnuplot” and “gnuplotlib”. We have chosen the first one here but the second which is newer seems also to be more complete.
There exists two libraries providing a Nim interface to “gnuplot” (the GNU plotting program), which are named “gnuplot” and “gnuplotlib”. We have chosen the second one as it is be more complete and more convenient to use.


The library launches “gnuplot” which does the plotting. From “gnuplot”, it is possible to save the drawing into a PDF, a SVG or an image (BMP, PNG) file.
The library launches “gnuplot” which does the plotting. From “gnuplot”, it is possible to save the drawing into a PDF, a SVG or an image (BMP, PNG) file.
Line 2,205: Line 2,205:
y = [2.7, 2.8, 31.4, 38.1, 58.0, 76.2, 100.5, 130.0, 149.3, 180.0]
y = [2.7, 2.8, 31.4, 38.1, 58.0, 76.2, 100.5, 130.0, 149.3, 180.0]


withGnuPlot:
plot(x, y, "Coordinate pairs")
plot(x, y, "Coordinate pairs")
discard stdin.readChar # Needed as when the program exits, “gnuplot” is closed.</syntaxhighlight>
</syntaxhighlight>


===Using ggplotnim===
===Using ggplotnim===