{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "### Visualizing data from Daru containers\n", "DARU (Data Analysis in RUby) is a library for storage, analysis, manipulation and visualization of data. You can find information about daru in its [repository](https://github.com/v0dro/daru).\n", "\n", "GnuplotRB takes from Daru::Vector or Daru::DataFrame *name* as dataset's *title* and *index* column as *xtic*. Example:" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "
Daru::DataFrame:33875020 rows: 4 cols: 4
BuildDeployTestOverall
Run A3122155251052
Run B63044110502121
Run C3153707011386
Run D3122205141046
" ], "text/plain": [ "\n", "#\n", " Build Deploy Test Overall \n", " Run A 312 215 525 1052 \n", " Run B 630 441 1050 2121 \n", " Run C 315 370 701 1386 \n", " Run D 312 220 514 1046 \n" ] }, "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ "require 'daru'\n", "require 'gnuplotrb'\n", "include GnuplotRB\n", "include GnuplotRB::Fit\n", "\n", "df = Daru::DataFrame.new({\n", " Build: [312, 630, 315, 312],\n", " Test: [525, 1050, 701, 514],\n", " Deploy: [215, 441, 370, 220]\n", " },\n", " index: ['Run A', 'Run B', 'Run C', 'Run D']\n", ")\n", "df[:Overall] = df[:Build] + df[:Test] + df[:Deploy]\n", "df" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "When you pass DataFrame to Plot.new it uses every column of DataFrame as a dataset with column name as dataset title:" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [ { "data": { "image/svg+xml": [ "\n", "\n", "\n", "\n", "Gnuplot\n", "Produced by GNUPLOT 5.0 patchlevel rc2 \n", "\n", "\n", "\n", "\n", "\n", "\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t \n", "\t \n", "\t\n", "\t\n", "\t \n", "\t \n", "\t\n", "\n", "\n", "\n", "\n", "\t\t\n", "\t\t 0\n", "\t\n", "\n", "\n", "\t\t\n", "\t\t 500\n", "\t\n", "\n", "\n", "\t\t\n", "\t\t 1000\n", "\t\n", "\n", "\n", "\t\t\n", "\t\t 1500\n", "\t\n", "\n", "\n", "\t\t\n", "\t\t 2000\n", "\t\n", "\n", "\n", "\t\t\n", "\t\tRun A\n", "\t\n", "\n", "\n", "\t\t\n", "\t\tRun B\n", "\t\n", "\n", "\n", "\t\t\n", "\t\tRun C\n", "\t\n", "\n", "\n", "\t\t\n", "\t\tRun D\n", "\t\n", "\n", "\n", "\n", "\n", "\t\n", "\n", "\t\n", "\t\tTime, s\n", "\t\n", "\n", "\n", "\t\n", "\t\tNumber of test\n", "\t\n", "\n", "\n", "\t\n", "\t\tTime spent to run deploy pipeline\n", "\t\n", "\n", "\tBuild\n", "\n", "\t\n", "\t\tBuild\n", "\t\n", "\n", "\n", "\t\n", "\t\n", "\tDeploy\n", "\n", "\t\n", "\t\tDeploy\n", "\t\n", "\n", "\n", "\t\n", "\t\n", "\tTest\n", "\n", "\t\n", "\t\tTest\n", "\t\n", "\n", "\n", "\t\n", "\t\n", "\tOverall\n", "\n", "\t\n", "\t\tOverall\n", "\t\n", "\n", "\n", "\t\n", "\t\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\t\n", "\n", "\n", "\n", "\n", "\n" ], "text/plain": [ "# \"lines\", :xlabel => \"Number of test\", :ylabel => \"Time, s\", :title => \"Time spent to run deploy pipeline\", :yrange => 0..2200], @datasets=Hamster::Vector[#, @options=Hamster::Hash[:title => :Build, :using => \"2:xtic(1)\"]>, #, @options=Hamster::Hash[:title => :Deploy, :using => \"2:xtic(1)\"]>, #, @options=Hamster::Hash[:title => :Test, :using => \"2:xtic(1)\"]>, #, @options=Hamster::Hash[:title => :Overall, :using => \"2:xtic(1)\"]>], @cmd=\"plot \">" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "from_daru = Plot.new(\n", " df,\n", " style_data: 'lines',\n", " yrange: 0..2200,\n", " xlabel: 'Number of test',\n", " ylabel: 'Time, s',\n", " title: 'Time spent to run deploy pipeline'\n", ")" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": false }, "outputs": [ { "data": { "image/svg+xml": [ "\n", "\n", "\n", "\n", "Gnuplot\n", "Produced by GNUPLOT 5.0 patchlevel rc2 \n", "\n", "\n", "\n", "\n", "\n", "\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t \n", "\t \n", "\t\n", "\t\n", "\t \n", "\t \n", "\t\n", "\n", "\n", "\n", "\n", "\t\t\n", "\t\t 0\n", "\t\n", "\n", "\n", "\t\t\n", "\t\t 500\n", "\t\n", "\n", "\n", "\t\t\n", "\t\t 1000\n", "\t\n", "\n", "\n", "\t\t\n", "\t\t 1500\n", "\t\n", "\n", "\n", "\t\t\n", "\t\t 2000\n", "\t\n", "\n", "\n", "\t\t\n", "\t\tRun A\n", "\t\n", "\n", "\n", "\t\t\n", "\t\tRun B\n", "\t\n", "\n", "\n", "\t\t\n", "\t\tRun C\n", "\t\n", "\n", "\n", "\t\t\n", "\t\tRun D\n", "\t\n", "\n", "\n", "\n", "\n", "\t\n", "\n", "\t\n", "\t\tTime, s\n", "\t\n", "\n", "\n", "\t\n", "\t\tNumber of test\n", "\t\n", "\n", "\n", "\t\n", "\t\tTime spent to run deploy pipeline\n", "\t\n", "\n", "\tBuild\n", "\n", "\t\n", "\t\tBuild\n", "\t\n", "\n", "\n", "\t\n", "\t\t\n", "\t\t\n", "\t\n", "\t\n", "\t\t\n", "\t\n", "\t\n", "\n", "\t\n", "\t\t\n", "\t\t\n", "\t\n", "\t\n", "\t\t\n", "\t\n", "\t\t\n", "\t\t\n", "\t\n", "\t\t\n", "\t\t\n", "\t\n", "\t\t\n", "\t\t\n", "\t\n", "\t\n", "\t\n", "\tDeploy\n", "\n", "\t\n", "\t\tDeploy\n", "\t\n", "\n", "\n", "\t\n", "\t\t\n", "\t\t\t\n", "\t\t\n", "\t\n", "\t\n", "\t\t\n", "\t\n", "\t\n", "\n", "\t\n", "\t\t\n", "\t\t\t\n", "\t\t\n", "\t\n", "\t\n", "\t\t\n", "\t\n", "\t\t\n", "\t\t\n", "\t\n", "\t\t\n", "\t\t\n", "\t\n", "\t\t\n", "\t\t\n", "\t\n", "\t\n", "\t\n", "\tTest\n", "\n", "\t\n", "\t\tTest\n", "\t\n", "\n", "\n", "\t\n", "\t\t\n", "\t\t\t\n", "\t\t\n", "\t\n", "\t\n", "\t\t\n", "\t\n", "\t\n", "\n", "\t\n", "\t\t\n", "\t\t\t\n", "\t\t\n", "\t\n", "\t\n", "\t\t\n", "\t\n", "\t\t\n", "\t\t\n", "\t\n", "\t\t\n", "\t\t\n", "\t\n", "\t\t\n", "\t\t\n", "\t\n", "\t\n", "\t\n", "\tOverall\n", "\n", "\t\n", "\t\tOverall\n", "\t\n", "\n", "\n", "\t\n", "\t\t\n", "\t\t\t\n", "\t\t\n", "\t\n", "\t\n", "\t\t\n", "\t\n", "\t\n", "\n", "\t\n", "\t\t\n", "\t\t\t\n", "\t\t\n", "\t\n", "\t\n", "\t\t\n", "\t\n", "\t\t\n", "\t\t\n", "\t\n", "\t\t\n", "\t\t\n", "\t\n", "\t\t\n", "\t\t\n", "\t\n", "\t\n", "\t\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\t\n", "\n", "\n", "\n", "\n", "\n" ], "text/plain": [ "# \"histograms\", :xlabel => \"Number of test\", :ylabel => \"Time, s\", :title => \"Time spent to run deploy pipeline\", :style_fill => \"pattern border\", :yrange => 0..2200], @datasets=Hamster::Vector[#, @options=Hamster::Hash[:title => :Build, :using => \"2:xtic(1)\"]>, #, @options=Hamster::Hash[:title => :Deploy, :using => \"2:xtic(1)\"]>, #, @options=Hamster::Hash[:title => :Test, :using => \"2:xtic(1)\"]>, #, @options=Hamster::Hash[:title => :Overall, :using => \"2:xtic(1)\"]>], @cmd=\"plot \">" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "from_daru.options(\n", " style_data: 'histograms',\n", " style_fill: 'pattern border'\n", ")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Datasets may be initialized both with Array or DataFrame:" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false }, "outputs": [ { "data": { "image/svg+xml": [ "\n", "\n", "\n", "\n", "Gnuplot\n", "Produced by GNUPLOT 5.0 patchlevel rc2 \n", "\n", "\n", "\n", "\n", "\n", "\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t \n", "\t \n", "\t\n", "\t\n", "\t \n", "\t \n", "\t\n", "\n", "\n", "\n", "\n", "\t\t\n", "\t\t 1000\n", "\t\n", "\n", "\n", "\t\t\n", "\t\t 1200\n", "\t\n", "\n", "\n", "\t\t\n", "\t\t 1400\n", "\t\n", "\n", "\n", "\t\t\n", "\t\t 1600\n", "\t\n", "\n", "\n", "\t\t\n", "\t\t 1800\n", "\t\n", "\n", "\n", "\t\t\n", "\t\t 2000\n", "\t\n", "\n", "\n", "\t\t\n", "\t\t 2200\n", "\t\n", "\n", "\n", "\t\t\n", "\t\tRun A\n", "\t\n", "\n", "\n", "\t\t\n", "\t\tRun B\n", "\t\n", "\n", "\n", "\t\t\n", "\t\tRun C\n", "\t\n", "\n", "\n", "\t\t\n", "\t\tRun D\n", "\t\n", "\n", "\n", "\n", "\n", "\t\n", "\n", "\n", "\tOverall\n", "\n", "\t\n", "\t\tOverall\n", "\t\n", "\n", "\n", "\t\n", "\t\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\t\n", "\n", "\n", "\n", "\n", "\n" ], "text/plain": [ "#, @options=Hamster::Hash[:with => \"lines\", :using => \"2:xtic(1)\", :title => :Overall]>], @cmd=\"plot \">" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Plot.new([df[:Overall], with: 'lines'])" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": false }, "outputs": [ { "data": { "image/svg+xml": [ "\n", "\n", "\n", "\n", "Gnuplot\n", "Produced by GNUPLOT 5.0 patchlevel rc2 \n", "\n", "\n", "\n", "\n", "\n", "\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t \n", "\t \n", "\t\n", "\t\n", "\t \n", "\t \n", "\t\n", "\n", "\n", "\n", "\n", "\t\t\n", "\t\t-100\n", "\t\n", "\n", "\n", "\t\t\n", "\t\t 0\n", "\t\n", "\n", "\n", "\t\t\n", "\t\t 100\n", "\t\n", "\n", "\n", "\t\t\n", "\t\t 200\n", "\t\n", "\n", "\n", "\t\t\n", "\t\t 300\n", "\t\n", "\n", "\n", "\t\t\n", "\t\t 400\n", "\t\n", "\n", "\n", "\t\t\n", "\t\t 500\n", "\t\n", "\n", "\n", "\t\t\n", "\t\t 600\n", "\t\n", "\n", "\n", "\t\t\n", "\t\t 700\n", "\t\n", "\n", "\n", "\t\t\n", "\t\t 800\n", "\t\n", "\n", "\n", "\t\t\n", "\t\t 900\n", "\t\n", "\n", "\n", "\t\t\n", "\t\t 0\n", "\t\n", "\n", "\n", "\t\t\n", "\t\t 5\n", "\t\n", "\n", "\n", "\t\t\n", "\t\t 10\n", "\t\n", "\n", "\n", "\t\t\n", "\t\t 15\n", "\t\n", "\n", "\n", "\t\t\n", "\t\t 20\n", "\t\n", "\n", "\n", "\t\t\n", "\t\t 25\n", "\t\n", "\n", "\n", "\t\t\n", "\t\t 30\n", "\t\n", "\n", "\n", "\n", "\n", "\t\n", "\n", "\n", "\tAverage value\n", "\n", "\t\n", "\t\tAverage value\n", "\t\n", "\n", "\n", "\t\n", "\t\n", "\tConfidence interval\n", "\n", "\t\n", "\t\tConfidence interval\n", "\t\n", "\n", "\n", "\t\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\n", "\t\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\t\n", "\n", "\n", "\n", "\n", "\n" ], "text/plain": [ "#, @options=Hamster::Hash[:with => \"lines\", :using => \"1:2\", :title => \"Average value\"]>, #, @options=Hamster::Hash[:with => \"err\", :using => \"1:2:3\", :title => :\"Confidence interval\"]>], @cmd=\"plot \">" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "rows = (1..30).map do |i|\n", " [i**2 * (rand(4) + 3) / 5, rand(70)]\n", "end\n", "df = Daru::DataFrame.rows(rows, order: [:Value, :Error], name: 'Confidence interval')\n", "\n", "random_points = Plot.new(\n", " [df[:Value], with: 'lines', title: 'Average value'],\n", " [df, with: 'err']\n", ")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "ok, and now lets try to fit it with polynomial:" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": false }, "outputs": [ { "data": { "image/svg+xml": [ "\n", "\n", "\n", "\n", "Gnuplot\n", "Produced by GNUPLOT 5.0 patchlevel rc2 \n", "\n", "\n", "\n", "\n", "\n", "\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t \n", "\t \n", "\t\n", "\t\n", "\t \n", "\t \n", "\t\n", "\n", "\n", "\n", "\n", "\t\t\n", "\t\t-100\n", "\t\n", "\n", "\n", "\t\t\n", "\t\t 0\n", "\t\n", "\n", "\n", "\t\t\n", "\t\t 100\n", "\t\n", "\n", "\n", "\t\t\n", "\t\t 200\n", "\t\n", "\n", "\n", "\t\t\n", "\t\t 300\n", "\t\n", "\n", "\n", "\t\t\n", "\t\t 400\n", "\t\n", "\n", "\n", "\t\t\n", "\t\t 500\n", "\t\n", "\n", "\n", "\t\t\n", "\t\t 600\n", "\t\n", "\n", "\n", "\t\t\n", "\t\t 700\n", "\t\n", "\n", "\n", "\t\t\n", "\t\t 800\n", "\t\n", "\n", "\n", "\t\t\n", "\t\t 900\n", "\t\n", "\n", "\n", "\t\t\n", "\t\t 0\n", "\t\n", "\n", "\n", "\t\t\n", "\t\t 5\n", "\t\n", "\n", "\n", "\t\t\n", "\t\t 10\n", "\t\n", "\n", "\n", "\t\t\n", "\t\t 15\n", "\t\n", "\n", "\n", "\t\t\n", "\t\t 20\n", "\t\n", "\n", "\n", "\t\t\n", "\t\t 25\n", "\t\n", "\n", "\n", "\t\t\n", "\t\t 30\n", "\t\n", "\n", "\n", "\n", "\n", "\t\n", "\n", "\n", "\tFit formula\n", "\n", "\t\n", "\t\tFit formula\n", "\t\n", "\n", "\n", "\t\n", "\t\n", "\tAverage value\n", "\n", "\t\n", "\t\tAverage value\n", "\t\n", "\n", "\n", "\t\n", "\t\n", "\tConfidence interval\n", "\n", "\t\n", "\t\tConfidence interval\n", "\t\n", "\n", "\n", "\t\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\n", "\t\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\t\n", "\n", "\n", "\n", "\n", "\n" ], "text/plain": [ "# \"Fit formula\"]>, #, @options=Hamster::Hash[:with => \"lines\", :using => \"1:2\", :title => \"Average value\"]>, #, @options=Hamster::Hash[:with => \"err\", :using => \"1:2:3\", :title => :\"Confidence interval\"]>], @cmd=\"plot \">" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "poly = fit_poly(df, degree: 5)\n", "random_points.add_dataset(poly[:formula_ds])" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "collapsed": false }, "outputs": [ { "data": { "image/svg+xml": [ "\n", "\n", "\n", "\n", "Gnuplot\n", "Produced by GNUPLOT 5.0 patchlevel rc2 \n", "\n", "\n", "\n", "\n", "\n", "\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t \n", "\t \n", "\t\n", "\t\n", "\t \n", "\t \n", "\t\n", "\n", "\n", "\n", "\n", "\t\t\n", "\t\t 0\n", "\t\n", "\n", "\n", "\t\t\n", "\t\t 0.2\n", "\t\n", "\n", "\n", "\t\t\n", "\t\t 0.4\n", "\t\n", "\n", "\n", "\t\t\n", "\t\t 0.6\n", "\t\n", "\n", "\n", "\t\t\n", "\t\t 0.8\n", "\t\n", "\n", "\n", "\t\t\n", "\t\t 1\n", "\t\n", "\n", "\n", "\t\t\n", "\t\t 0\n", "\t\n", "\n", "\n", "\t\t\n", "\t\t 20\n", "\t\n", "\n", "\n", "\t\t\n", "\t\t 40\n", "\t\n", "\n", "\n", "\t\t\n", "\t\t 60\n", "\t\n", "\n", "\n", "\t\t\n", "\t\t 80\n", "\t\n", "\n", "\n", "\t\t\n", "\t\t 100\n", "\t\n", "\n", "\n", "\n", "\n", "\t\n", "\n", "\n", "\tScatter example\n", "\n", "\t\n", "\t\tScatter example\n", "\t\n", "\n", "\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\n", "\t\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\t\n", "\n", "\n", "\n", "\n", "\n" ], "text/plain": [ "# -10..110, :yrange => -0.1..1.1], @datasets=Hamster::Vector[#, @options=Hamster::Hash[:pt => 6, :ps => 1, :title => :\"Scatter example\", :using => \"2:3\"]>], @cmd=\"plot \">" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df = Daru::DataFrame.new({\n", " a: Array.new(100) {|i| i}, \n", " b: 100.times.map{rand}\n", " },\n", " name: 'Scatter example'\n", ")\n", "\n", "Plot.new([df, pt: 6, ps: 1, using: '2:3'], xrange: -10..110, yrange: -0.1..1.1)" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "#, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">, #, @options=Hamster::Hash[:pt => 6, :using => \"2:3\", :title => :\"Scatter example\", :ps => 1]>], @cmd=\"plot \">], @options=Hamster::Hash[:xrange => -10..110, :yrange => -0.1..1.1]>" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "frames = 100.times.map do |i|\n", " Plot.new([df.row[0..i], using: '2:3', pt: 6, ps: 1])\n", "end\n", "\n", "Animation.new(*frames, xrange: -10..110, yrange: -0.1..1.1)" ] } ], "metadata": { "kernelspec": { "display_name": "Ruby 2.1.2", "language": "ruby", "name": "ruby" }, "language_info": { "file_extension": "rb", "mimetype": "application/x-ruby", "name": "ruby", "version": "2.1.2" } }, "nbformat": 4, "nbformat_minor": 0 }