Method: GnuplotRB::Plottable#to_canvas

Defined in:
lib/gnuplotrb/mixins/plottable.rb

#to_canvas(path = nil, **options) ⇒ String

Output to plot to according image format.

All of #to_|terminal_name| methods are handled with #method_missing.

Gnuplot offers possibility to output graphics to many image formats. The easiest way to to so is to use #to_<plot_name> methods.

Examples:

# font options specific for png term
multiplot.to_png('./result.png', size: [300, 500], font: ['arial', 12])
# font options specific for svg term
content = multiplot.to_svg(size: [100, 100], fname: 'Arial', fsize: 12)

Parameters:

  • path (String) (defaults to: nil)

    path to save plot file to.

  • options (Hash)

    specific terminal options like ‘size’, ‘font’ etc

Returns:

  • (String)

    contents of plotted file unless path given

  • self if path given



# File 'lib/gnuplotrb/mixins/plottable.rb', line 183