vplot is a wrapper for GNU Plot (gnuplot_i). The source of gnuplot_i I have downloaded from this link. Files listed on gnuplot_i are taken from downloaded sources, including the license file.
First, you need to install the gnuplot.
Import vplot library:
import vplotDeclare a new Plot object:
mut p1 := vplot.new()Set a style and plot a slope of this function y=ax+b, where a = 2 and b = 0 and title y=2x. Also set label of X axis (x) and for Y axis (2x).
p1.style(vplot.style_linespoints)
p1.label_x(`x`)
p1.label_y(`y`)
p1.plot_slope(2.0)Whenever you start a new plot session, you should closed it once you are done with it. But, in this simple example, you would not be able to see the output. To be able to see the output, we are going to call os.input() function in order to wait for any key to be pressed before closeing the plot session.
os.input('Press any key ...')
p1.close()- Removed all examples and moved to vplot-playground
- Adding support for multiplots (similar to subplots in GNU Octave). Check example multiplot.v
vplot.style_linesvplot.style_pointsvplot.style_linespointsvplot.style_impulsesvplot.style_dotsvplot.style_stepsvplot.style_errorbarsvplot.style_boxesvplot.style_boxeserrorbars
-
new -
Plot.close() -
Plot.style(string) -
Plot.plot_slope(f64, f64, string) -
Plot.plot_equation(string, string) -
Plot.reset() -
Plot.enable_multiplot(Multiplotter) -
Plot.disable_multiplot() -
Plot.command(string) -
Plot.commands([]string) -
Plot.plot2d([]f64, []f64, string) -
Plot.plot([]f64, string) -
Plot.label_x(string) -
Plot.label_y(string) -
vplot.write_x_csv(string, []f64, string) -
vplot.write_xy_csv(string, []f64, []f64, string) -
vplot.write_csv(string, []f64, []f64, string) -
vplot.PlotSession{} -
vplot.plotter(PlotSession)

