{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": false, "scrolled": true }, "outputs": [ { "data": { "text/html": [ "\n", " \n", "\n", "\n", "
\n", "\n", "" ], "text/plain": [ "#[[1, 20, 30], [20, 1, 60], [30, 60, 1]], :type=>:heatmap}], @layout={}, @config={:linkText=>\"Export to plot.ly\", :showLink=>true}, @embedded=true>" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# Basic Heatmap\n", "require 'rbplotly'\n", "\n", "z = [\n", " [1, 20, 30],\n", " [20, 1, 60],\n", " [30, 60, 1]\n", "]\n", "\n", "data = [{\n", " z: z,\n", " type: :heatmap\n", "}]\n", "\n", "plot = Plotly::Plot.new(data: data)\n", "plot.show" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "\n", " \n", "\n", "\n", "
\n", "\n", "" ], "text/plain": [ "#[[0, 6, 5, 5, 3, 9, 6, 6, 9, 7], [6, 3, 2, 5, 9, 1, 4, 6, 7, 4], [7, 6, 8, 2, 1, 0, 0, 1, 3, 7], [6, 8, 8, 4, 3, 1, 0, 8, 5, 3], [1, 2, 4, 0, 2, 6, 4, 2, 7, 6], [3, 2, 9, 6, 2, 7, 5, 6, 1, 5], [2, 0, 3, 4, 4, 8, 6, 9, 2, 9], [3, 5, 0, 6, 7, 0, 8, 6, 6, 0], [0, 8, 3, 9, 7, 6, 5, 0, 9, 9], [6, 4, 3, 5, 2, 8, 2, 8, 6, 8]], :type=>:heatmap, :x=>[\"x1\", \"x2\", \"x3\", \"x4\", \"x5\", \"x6\", \"x7\", \"x8\", \"x9\", \"x10\"], :y=>[\"y1\", \"y2\", \"y3\", \"y4\", \"y5\", \"y6\", \"y7\", \"y8\", \"y9\", \"y10\"]}], @layout={:width=>500, :height=>500}, @config={:linkText=>\"Export to plot.ly\", :showLink=>true}, @embedded=true>" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "require 'rbplotly'\n", "\n", "n = 10\n", "data = {\n", " x: (1..n).map { |i| \"x#{i}\" },\n", " y: (1..n).map { |i| \"y#{i}\" },\n", " z: (1..n).map { (1..n).map { rand(10) } },\n", " type: :heatmap\n", "}\n", "\n", "layout = {\n", " width: 500,\n", " height: 500\n", "}\n", "\n", "plot = Plotly::Plot.new(data: [data], layout: layout)\n", "plot.show" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Ruby 2.3.1", "language": "ruby", "name": "ruby" }, "language_info": { "file_extension": ".rb", "mimetype": "application/x-ruby", "name": "ruby", "version": "2.3.1" } }, "nbformat": 4, "nbformat_minor": 1 }