require 'mikon' path = File.expand_path("../iris.csv", __FILE__) df = Mikon::DataFrame.from_csv(path) plot = df.plot(type: :scatter, x: :sepal_length, y: :petal_length, fill_by: :species, color: :qual) require 'statsample' lr = Statsample::Regression.simple(df[:sepal_length], df[:petal_length]) puts lr.summary a, b = lr.a, lr.b x = (df[:sepal_length].min.round..df[:sepal_length].max.round).to_a y = x.map{|v| b*v+a} plot.add(:line, x, y) plot