{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Setup environment: \n", "In order to create plots using data shader, you must first setup your python environment by installing the required packages. This requires [Anaconda Python distribution](https://www.continuum.io/downloads). For simplicity, this guide demonstrates using an [Anaconda virtual environment](https://conda.io/docs/using/envs.html). \n", "\n", "First, create your python environment (answer `y` to proceed)\n", "```\n", "conda create -n plotting python=3.6\n", "```\n", "then activate the environment\n", "```\n", "source activate plotting\n", "```\n", "Note that your terminal prompt now has `(plotting)` on the left, showing which python environment you have active.\n", "Now install datashader from the bokeh channel packages (answer `y` to proceed)\n", "```\n", "conda install -c bokeh datashader\n", "```\n", "This should bring in most of the other requirements. You still need `bokeh`, `ipython`, and `jupyter` so lets install them (again answer `y` to proceed)\n", "```\n", "conda install ipython jupyter bokeh matplotlib\n", "```\n", "At this point, you may want to deactivate, then reactivate your python environment to make sure the path is updated (sometimes `ipython` requires this step so I include it in case this is your situation)\n", "```\n", "source deactivate\n", "source activate plotting\n", "```\n", "You can now directly open this notebook using the command\n", "```\n", "jupyter notebook dense\\ plot.ipynb\n", "```\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Imports" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": true }, "outputs": [], "source": [ "import os\n", "import requests" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": true }, "outputs": [], "source": [ "import numpy as np\n", "import pandas as pd" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": true }, "outputs": [], "source": [ "import datashader as ds\n", "import datashader.transfer_functions as tf\n", "from datashader.bokeh_ext import InteractiveImage, create_ramp_legend" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "\n", "
" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", "(function(global) {\n", " function now() {\n", " return new Date();\n", " }\n", "\n", " var force = true;\n", "\n", " if (typeof (window._bokeh_onload_callbacks) === \"undefined\" || force === true) {\n", " window._bokeh_onload_callbacks = [];\n", " window._bokeh_is_loading = undefined;\n", " }\n", "\n", "\n", " \n", " if (typeof (window._bokeh_timeout) === \"undefined\" || force === true) {\n", " window._bokeh_timeout = Date.now() + 5000;\n", " window._bokeh_failed_load = false;\n", " }\n", "\n", " var NB_LOAD_WARNING = {'data': {'text/html':\n", " \"\\n\"+\n", " \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n", " \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n", " \"
\\n\"+\n", " \"\\n\"+\n",
" \"from bokeh.resources import INLINE\\n\"+\n",
" \"output_notebook(resources=INLINE)\\n\"+\n",
" \"
\\n\"+\n",
" \"\n", " | Rg | \n", "R-factor | \n", "
---|---|---|
id | \n", "\n", " | \n", " |
1 | \n", "111.020562 | \n", "0.203760 | \n", "
2 | \n", "111.020621 | \n", "0.203759 | \n", "
3 | \n", "111.014174 | \n", "0.203978 | \n", "
4 | \n", "111.159593 | \n", "0.203095 | \n", "
5 | \n", "111.162165 | \n", "0.203032 | \n", "