{ "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:34354820 rows: 4 cols: 4
BuildDeployTestOverall
03122155251052
163044110502121
23153707011386
33122205141046
" ], "text/plain": [ "\n", "#\n", " Build Deploy Test Overall \n", " 0 312 215 525 1052 \n", " 1 630 441 1050 2121 \n", " 2 315 370 701 1386 \n", " 3 312 220 514 1046 \n" ] }, "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ "require 'daru'\n", "require 'gnuplotrb'\n", "include GnuplotRB\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", "df[:Overall] = df[:Build] + df[:Test] + df[:Deploy]\n", "df" ] }, { "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\t0\n", "\t\n", "\n", "\n", "\t\t\n", "\t\t1\n", "\t\n", "\n", "\n", "\t\t\n", "\t\t2\n", "\t\n", "\n", "\n", "\t\t\n", "\t\t3\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": [ "#, @options=Hamster::Hash[:using => \"2:xtic(1)\", :title => :Build]>, #, @options=Hamster::Hash[:using => \"2:xtic(1)\", :title => :Deploy]>, #, @options=Hamster::Hash[:using => \"2:xtic(1)\", :title => :Test]>, #, @options=Hamster::Hash[:using => \"2:xtic(1)\", :title => :Overall]>], @options=Hamster::Hash[:style_data => \"histograms\", :xlabel => \"Number of test\", :yrange => 0..2200, :style_fill => \"pattern border\", :ylabel => \"Time, s\", :title => \"Time spent to run deploy pipeline\"], @already_plotted=true, @cmd=\"plot \", @terminal=#&1\", @current_datablock=0, @err_array=[], @in=#>>" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "datasets = df.map { |column| Dataset.new(column) }\n", "\n", "Plot.new(\n", " *datasets,\n", " style_data: 'histograms',\n", " style_fill: 'pattern border',\n", " yrange: 0..2200,\n", " xlabel: 'Number of test',\n", " ylabel: 'Time, s',\n", " title: 'Time spent to run deploy pipeline'\n", ")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### WIP" ] } ], "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 }