lib/gnuplotrb/plot.rb
##
# Create new Plot object where dataset at *position* will
# be replaced with the new one created from it by updating.
#
# @param position [Integer] position of dataset which you need to update
#   (by default first dataset is updated)
# @param data [#to_gnuplot_points] data to update dataset with
# @param options [Hash] options to update dataset with, see Dataset top level doc
#
# @example
#   updated_plot = plot.update_dataset(data: [x1,y1], title: 'After update')
#   # plot IS NOT affected (if dataset did not store data in a file)
Create new Plot object where dataset at *position* will
be replaced with the new one created from it by updating.
Create new Plot object where dataset at * position * will be replaced with the new one created from it by updating .
def update_dataset(position = 0, data: nil, **options)
      old_ds = @datasets[position]
      new_ds = old_ds.update(data, options)
      new_ds.equal?(old_ds) ? self : replace_dataset(position, new_ds)
    end
def update_dataset ( position = 0 , data : nil , ** options ) old_ds = @datasets [ position ] new_ds = old_ds . update ( data , options ) new_ds . equal? ( old_ds ) ? self : replace_dataset ( position , new_ds ) end
Create new Plot object where dataset at *position* will
be replaced with the new one created from it by updating.
Create new Plot object where dataset at * position * will be replaced with the new one created from it by updating .
position
position of dataset which you need to update (by default first dataset is updated)
position of dataset which you need to update ( by default first dataset is updated )
data
data to update dataset with
data to update dataset with
options
options to update dataset with, see Dataset top level doc
options to update dataset with see Dataset top level doc
example
updated_plot = plot.update_dataset(data: [x1,y1], title: 'After update') # plot IS NOT affected (if dataset did not store data in a file)
updated_plot = plot . update_dataset ( data : [ x1 y1 ] title : ' After update ' ) # plot IS NOT affected ( if dataset did not store data in a file )