Skip to content

Instantly share code, notes, and snippets.

@chriddyp
Created April 15, 2015 15:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chriddyp/1a34b39e85afec58ab54 to your computer and use it in GitHub Desktop.
Save chriddyp/1a34b39e85afec58ab54 to your computer and use it in GitHub Desktop.
{"nbformat_minor": 0, "cells": [{"execution_count": 8, "cell_type": "code", "source": "import plotly.plotly as py\nfrom plotly.graph_objs import *\n\nimport datetime\n\ndef to_unix_time(dt):\n epoch = datetime.datetime.utcfromtimestamp(0)\n return (dt - epoch).total_seconds() * 1000\n\nx = [\n datetime.datetime(year=2013, month=10, day=04),\n datetime.datetime(year=2013, month=11, day=05),\n datetime.datetime(year=2013, month=12, day=06)\n]\n\ndata = Data([\n Scatter(\n x=x,\n y=[1, 3, 6]\n )\n])\n\nlayout = Layout(\n xaxis = XAxis(\n range = [\n to_unix_time(datetime.datetime(2013, 10, 17)),\n to_unix_time(datetime.datetime(2013, 11, 20))\n ]\n )\n)\n\n\nfig = Figure(data = data, layout = layout)\n\nplot_url = py.plot(fig, filename='python-datetime-custom-ranges')", "outputs": [], "metadata": {"collapsed": false, "trusted": true}}, {"execution_count": 9, "cell_type": "code", "source": "fig", "outputs": [{"execution_count": 9, "output_type": "execute_result", "data": {"text/plain": "{'data': [{'type': u'scatter',\n 'x': [datetime.datetime(2013, 10, 4, 0, 0),\n datetime.datetime(2013, 11, 5, 0, 0),\n datetime.datetime(2013, 12, 6, 0, 0)],\n 'y': [1, 3, 6]}],\n 'layout': {'xaxis': {'range': [1381968000000.0, 1384905600000.0]}}}"}, "metadata": {}}], "metadata": {"collapsed": false, "trusted": true}}, {"execution_count": 10, "cell_type": "code", "source": "fig['data']", "outputs": [{"execution_count": 10, "output_type": "execute_result", "data": {"text/plain": "[{'type': u'scatter',\n 'x': [datetime.datetime(2013, 10, 4, 0, 0),\n datetime.datetime(2013, 11, 5, 0, 0),\n datetime.datetime(2013, 12, 6, 0, 0)],\n 'y': [1, 3, 6]}]"}, "metadata": {}}], "metadata": {"collapsed": false, "trusted": true}}, {"execution_count": 11, "cell_type": "code", "source": "fig['data'][0]", "outputs": [{"execution_count": 11, "output_type": "execute_result", "data": {"text/plain": "{'type': u'scatter',\n 'x': [datetime.datetime(2013, 10, 4, 0, 0),\n datetime.datetime(2013, 11, 5, 0, 0),\n datetime.datetime(2013, 12, 6, 0, 0)],\n 'y': [1, 3, 6]}"}, "metadata": {}}], "metadata": {"collapsed": false, "trusted": true}}, {"execution_count": 12, "cell_type": "code", "source": "fig['data'][0]['x']", "outputs": [{"execution_count": 12, "output_type": "execute_result", "data": {"text/plain": "[datetime.datetime(2013, 10, 4, 0, 0),\n datetime.datetime(2013, 11, 5, 0, 0),\n datetime.datetime(2013, 12, 6, 0, 0)]"}, "metadata": {}}], "metadata": {"collapsed": false, "trusted": true}}, {"execution_count": 13, "cell_type": "code", "source": "fig['data'][0]['y']", "outputs": [{"execution_count": 13, "output_type": "execute_result", "data": {"text/plain": "[1, 3, 6]"}, "metadata": {}}], "metadata": {"collapsed": false, "trusted": true}}, {"execution_count": 14, "cell_type": "code", "source": "dict(x=[1,2,3], y=[10,20,30])", "outputs": [{"execution_count": 14, "output_type": "execute_result", "data": {"text/plain": "{'x': [1, 2, 3], 'y': [10, 20, 30]}"}, "metadata": {}}], "metadata": {"collapsed": false, "trusted": true}}, {"execution_count": 15, "cell_type": "code", "source": "Scatter(x=[1,2,3], y=[10,20,30])", "outputs": [{"execution_count": 15, "output_type": "execute_result", "data": {"text/plain": "{'type': u'scatter', 'x': [1, 2, 3], 'y': [10, 20, 30]}"}, "metadata": {}}], "metadata": {"collapsed": false, "trusted": true}}, {"execution_count": 16, "cell_type": "code", "source": "Scatter(x=[1,2,3], y=[1,3,5], asdf=3)", "outputs": [{"ename": "PlotlyDictKeyError", "evalue": "Invalid key, 'asdf', for class, 'Scatter'.\n\nRun 'help(plotly.graph_objs.Scatter)' for more information.\n\nPath To Error:\n['asdf']\n\nAdditional Notes:\nCouldn't find uses for key: 'asdf'\n\n", "traceback": ["\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mPlotlyDictKeyError\u001b[0m Traceback (most recent call last)", "\u001b[0;32m<ipython-input-16-777b81b65479>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mScatter\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;36m2\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;36m3\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0my\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;36m3\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;36m5\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0masdf\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m3\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", "\u001b[0;32m//anaconda/lib/python2.7/site-packages/plotly/graph_objs/graph_objs.pyc\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 771\u001b[0m \"\"\"\n\u001b[1;32m 772\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m__init__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 773\u001b[0;31m \u001b[0msuper\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mPlotlyTrace\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__init__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 774\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__class__\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__name__\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;34m'PlotlyTrace'\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 775\u001b[0m warnings.warn(\"\\nThe PlotlyTrace class is a base class of \"\n", "\u001b[0;32m//anaconda/lib/python2.7/site-packages/plotly/graph_objs/graph_objs.pyc\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 327\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mclass_name\u001b[0m \u001b[0;34m!=\u001b[0m \u001b[0;34m'PlotlyTrace'\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mand\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mclass_name\u001b[0m \u001b[0;34m!=\u001b[0m \u001b[0;34m'Trace'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 328\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'type'\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mNAME_TO_KEY\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mclass_name\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 329\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mvalidate\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 330\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__class__\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__name__\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;34m'PlotlyDict'\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 331\u001b[0m warnings.warn(\"\\nThe PlotlyDict class is a base class of \"\n", "\u001b[0;32m//anaconda/lib/python2.7/site-packages/plotly/graph_objs/graph_objs.pyc\u001b[0m in \u001b[0;36mvalidate\u001b[0;34m(self, caller)\u001b[0m\n\u001b[1;32m 621\u001b[0m raise exceptions.PlotlyDictKeyError(obj=self,\n\u001b[1;32m 622\u001b[0m \u001b[0mkey\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mkey\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 623\u001b[0;31m notes=notes)\n\u001b[0m\u001b[1;32m 624\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 625\u001b[0m def to_string(self, level=0, indent=4, eol='\\n',\n", "\u001b[0;31mPlotlyDictKeyError\u001b[0m: Invalid key, 'asdf', for class, 'Scatter'.\n\nRun 'help(plotly.graph_objs.Scatter)' for more information.\n\nPath To Error:\n['asdf']\n\nAdditional Notes:\nCouldn't find uses for key: 'asdf'\n\n"], "output_type": "error"}], "metadata": {"scrolled": true, "collapsed": false, "trusted": true}}, {"execution_count": 17, "cell_type": "code", "source": "help(Scatter)", "outputs": [{"output_type": "stream", "name": "stdout", "text": "Help on class Scatter in module plotly.graph_objs.graph_objs:\n\nclass Scatter(PlotlyTrace)\n | A dictionary-like object for representing a scatter trace in plotly.\n | \n | Example:\n | \n | >>> py.plot([Scatter(name='tacters', x=[1,4,2,3], y=[1,6,2,1])])\n | \n | Online examples:\n | \n | https://plot.ly/python/line-and-scatter/\n | https://plot.ly/python/bubble-charts/\n | https://plot.ly/python/filled-area-plots/\n | https://plot.ly/python/time-series/\n | \n | Quick method reference:\n | \n | Scatter.update(changes)\n | Scatter.strip_style()\n | Scatter.get_data()\n | Scatter.to_graph_objs()\n | Scatter.validate()\n | Scatter.to_string()\n | Scatter.force_clean()\n | \n | Valid keys:\n | \n | x [required= when 'y','r' and 't' are unset] (value=list or 1d numpy\n | array of numbers, strings, datetimes) (streamable):\n | Sets the x coordinates of the points of this scatter trace. If 'x'\n | is linked to a list or 1d numpy array of strings, then the x\n | coordinates are integers, 0, 1, 2, 3, ..., labeled on the x-axis by\n | the list or 1d numpy array of strings linked to 'x'.\n | \n | y [required= when 'x','r' and 't' are unset] (value=list or 1d numpy\n | array of numbers, strings, datetimes) (streamable):\n | Sets the y coordinates of the points of this scatter trace. If 'y'\n | is linked to a list or 1d numpy array of strings, then the y\n | coordinates are integers, 0, 1, 2, 3, ..., labeled on the y-axis by\n | the list or 1d numpy array of strings linked to 'y'.\n | \n | r [required= when making a Polar Chart] (value=list or 1d numpy array of\n | numbers) (streamable):\n | For Polar charts only. Sets the radial coordinates of the points in\n | this polar scatter trace about the origin.\n | \n | t [required= when making a Polar Chart] (value=list or 1d numpy array of\n | numbers, strings, datetimes) (streamable):\n | For Polar charts only. Sets the angular coordinates of the points in\n | this polar scatter trace. By default, the angular coordinates are in\n | degrees (0 to 360) where the angles are measured clockwise about the\n | right-hand side of the origin. To change this behavior, modify\n | 'range' in 'angularaxis' or/and 'direction' in 'layout'. If 't' is\n | linked to a list or 1d numpy array of strings, then the angular\n | coordinates are 0, 360\\N, 2*360/N, ... where N is the number of\n | coordinates given labeled by the list or 1d numpy array of strings\n | linked to 't'.\n | \n | mode [required=False] (value='lines' | 'markers' | 'text' |\n | 'lines+markers' | 'lines+text' | 'markers+text' | 'lines+markers+text'):\n | Plotting mode for this scatter trace. If the mode includes 'text'\n | then the 'text' will appear at the (x,y) points, otherwise it will\n | appear on hover.\n | \n | name [required=False] (value=a string):\n | The label associated with this trace. This name will appear in the\n | legend, on hover and in the column header in the online spreadsheet.\n | \n | text [required=False] (value=list or 1d numpy array of strings)\n | (streamable):\n | The text elements associated with each (x,y) pair in this scatter\n | trace. If the scatter 'mode' does not include 'text' then elements\n | linked to 'text' will appear on hover only. In contrast, if 'text'\n | is included in 'mode', the elements in 'text' will be rendered on\n | the plot at the locations specified in part by their corresponding\n | (x,y) coordinate pair and the 'textposition' key.\n | \n | error_y [required=False] (value=ErrorY object | dictionary-like object)\n | (streamable):\n | Links a dictionary-like object describing the vertical error bars\n | (i.e. along the y-axis) that can be drawn from the (x,y) coordinates\n | of this scatter trace.\n | \n | For more, run `help(plotly.graph_objs.ErrorY)`\n | \n | error_x [required=False] (value=ErrorX object | dictionary-like object)\n | (streamable):\n | Links a dictionary-like object describing the horizontal error bars\n | (i.e. along the x-axis) that can be drawn from the (x,y) coordinates\n | of this scatter trace.\n | \n | For more, run `help(plotly.graph_objs.ErrorX)`\n | \n | marker [required=False] (value=Marker object | dictionary-like object)\n | (streamable):\n | Links a dictionary-like object containing marker style parameters\n | for this scatter trace. Has an effect only if 'mode' contains\n | 'markers'.\n | \n | For more, run `help(plotly.graph_objs.Marker)`\n | \n | line [required=False] (value=Line object | dictionary-like object)\n | (streamable):\n | Links a dictionary-like object containing line parameters for this\n | scatter trace. Has an effect only if 'mode' contains 'lines'.\n | \n | For more, run `help(plotly.graph_objs.Line)`\n | \n | textposition [required=False] (value='top left' | 'top' (or 'top\n | center')| 'top right' | 'left' (or 'middle left') | '' (or 'middle\n | center') | 'right' (or 'middle right') | 'bottom left' | 'bottom' (or\n | 'bottom center') | 'bottom right'):\n | Sets the position of the text elements in the 'text' key with\n | respect to the data points. By default, the text elements are\n | plotted directly at the (x,y) coordinates.\n | \n | textfont [required=False] (value=Font object | dictionary-like object):\n | Links a dictionary-like object describing the font style of this\n | scatter trace's text elements. Has only an effect if 'mode' is set\n | and includes 'text'.\n | \n | For more, run `help(plotly.graph_objs.Font)`\n | \n | connectgaps [required=False] (value=a boolean: True | False):\n | Toggle whether or not missing data points (i.e. '' or numpy.nan)\n | linked to 'x' and/or 'y', are added in by Plotly using linear\n | interpolation.\n | \n | fill [required=False] (value='none' | 'tozeroy' | 'tonexty' | 'tozerox'\n | | 'tonextx):\n | Use to make area-style charts. Determines which area to fill with a\n | solid color.By default, the area will appear in a more-transparent\n | shape of the line color (or of the marker color if 'mode' does not\n | contains 'lines').\n | \n | fillcolor [required=False] (value=a string describing color):\n | Sets the color that will appear in the specified fill area (set in\n | 'fill'). Has no effect if 'fill' is set to 'none'.\n | \n | Examples:\n | 'green' | 'rgb(0, 255, 0)' | 'rgba(0, 255, 0, 0.3)' |\n | 'hsl(120,100%,50%)' | 'hsla(120,100%,50%,0.3)' | '#434F1D'\n | \n | opacity [required=False] (value=number: x in [0, 1]):\n | Sets the opacity, or transparency, of the entire object, also known\n | as the alpha channel of colors. If the object's color is given in\n | terms of 'rgba' color model, 'opacity' is redundant.\n | \n | xaxis [required=False] (value='x1' | 'x2' | 'x3' | etc.):\n | This key determines which x-axis the x-coordinates of this trace\n | will reference in the figure. Values 'x1' and 'x' reference to\n | 'xaxis' in 'layout', 'x2' references to 'xaxis2' in 'layout', and so\n | on. Note that 'x1' will always refer to 'xaxis' or 'xaxis1' in\n | 'layout', they are the same.\n | \n | yaxis [required=False] (value='y1' | 'y2' | 'y3' | etc.):\n | This key determines which y-axis the y-coordinates of this trace\n | will reference in the figure. Values 'y1' and 'y' reference to\n | 'yaxis' in 'layout', 'y2' references to 'yaxis2' in 'layout', and so\n | on. Note that 'y1' will always refer to 'yaxis' or 'yaxis1' in\n | 'layout', they are the same.\n | \n | showlegend [required=False] (value=a boolean: True | False):\n | Toggle whether or not this trace will be labeled in the legend.\n | \n | stream [required=False] (value=Stream object | dictionary-like object):\n | Links a dictionary-like object that initializes this trace as a\n | writable-stream, for use with the streaming API.\n | \n | For more, run `help(plotly.graph_objs.Stream)`\n | \n | visible [required=False] (value=a boolean: True | False):\n | Toggles whether or not this object will be visible on the rendered\n | figure.\n | \n | xsrc [required= when 'y','r' and 't' are unset] (value=a string equal to\n | the unique identifier of a plotly grid column) (streamable):\n | Sets the x coordinates of the points of this scatter trace. If 'x'\n | is linked to a list or 1d numpy array of strings, then the x\n | coordinates are integers, 0, 1, 2, 3, ..., labeled on the x-axis by\n | the list or 1d numpy array of strings linked to 'x'.\n | \n | ysrc [required= when 'x','r' and 't' are unset] (value=a string equal to\n | the unique identifier of a plotly grid column) (streamable):\n | Sets the y coordinates of the points of this scatter trace. If 'y'\n | is linked to a list or 1d numpy array of strings, then the y\n | coordinates are integers, 0, 1, 2, 3, ..., labeled on the y-axis by\n | the list or 1d numpy array of strings linked to 'y'.\n | \n | type [required=False] (value='scatter'):\n | Plotly identifier for this data's trace type.\n | \n | Method resolution order:\n | Scatter\n | PlotlyTrace\n | PlotlyDict\n | __builtin__.dict\n | __builtin__.object\n | \n | Methods inherited from PlotlyTrace:\n | \n | __init__(self, *args, **kwargs)\n | \n | to_string(self, level=0, indent=4, eol='\\n', pretty=True, max_chars=80)\n | Returns a formatted string showing graph_obj constructors.\n | \n | Example:\n | \n | print(obj.to_string())\n | \n | Keyword arguments:\n | level (default = 0) -- set number of indentations to start with\n | indent (default = 4) -- set indentation amount\n | eol (default = '\\n') -- set end of line character(s)\n | pretty (default = True) -- curtail long list output with a '...'\n | max_chars (default = 80) -- set max characters per line\n | \n | ----------------------------------------------------------------------\n | Methods inherited from PlotlyDict:\n | \n | __setitem__(self, key, value)\n | \n | force_clean(self, caller=True)\n | Attempts to convert to graph_objs and call force_clean() on values.\n | \n | Calling force_clean() on a PlotlyDict will ensure that the object is\n | valid and may be sent to plotly. This process will also remove any\n | entries that end up with a length == 0.\n | \n | Careful! This will delete any invalid entries *silently*.\n | \n | get_data(self, flatten=False)\n | Returns the JSON for the plot with non-data elements stripped.\n | \n | get_ordered(self, caller=True)\n | \n | strip_style(self)\n | Strip style from the current representation.\n | \n | All PlotlyDicts and PlotlyLists are guaranteed to survive the\n | stripping process, though they made be left empty. This is allowable.\n | \n | Keys that will be stripped in this process are tagged with\n | `'type': 'style'` in graph_objs_meta.json.\n | \n | This process first attempts to convert nested collections from dicts\n | or lists to subclasses of PlotlyList/PlotlyDict. This process forces\n | a validation, which may throw exceptions.\n | \n | Then, each of these objects call `strip_style` on themselves and so\n | on, recursively until the entire structure has been validated and\n | stripped.\n | \n | to_graph_objs(self, caller=True)\n | Walk obj, convert dicts and lists to plotly graph objs.\n | \n | For each key in the object, if it corresponds to a special key that\n | should be associated with a graph object, the ordinary dict or list\n | will be reinitialized as a special PlotlyDict or PlotlyList of the\n | appropriate `kind`.\n | \n | update(self, dict1=None, **dict2)\n | Update current dict with dict1 and then dict2.\n | \n | This recursively updates the structure of the original dictionary-like\n | object with the new entries in the second and third objects. This\n | allows users to update with large, nested structures.\n | \n | Note, because the dict2 packs up all the keyword arguments, you can\n | specify the changes as a list of keyword agruments.\n | \n | Examples:\n | # update with dict\n | obj = Layout(title='my title', xaxis=XAxis(range=[0,1], domain=[0,1]))\n | update_dict = dict(title='new title', xaxis=dict(domain=[0,.8]))\n | obj.update(update_dict)\n | obj\n | {'title': 'new title', 'xaxis': {'range': [0,1], 'domain': [0,.8]}}\n | \n | # update with list of keyword arguments\n | obj = Layout(title='my title', xaxis=XAxis(range=[0,1], domain=[0,1]))\n | obj.update(title='new title', xaxis=dict(domain=[0,.8]))\n | obj\n | {'title': 'new title', 'xaxis': {'range': [0,1], 'domain': [0,.8]}}\n | \n | This 'fully' supports duck-typing in that the call signature is\n | identical, however this differs slightly from the normal update\n | method provided by Python's dictionaries.\n | \n | validate(self, caller=True)\n | Recursively check the validity of the keys in a PlotlyDict.\n | \n | The valid keys constitute the entries in each object\n | dictionary in graph_objs_meta.json\n | \n | The validation process first requires that all nested collections be\n | converted to the appropriate subclass of PlotlyDict/PlotlyList. Then,\n | each of these objects call `validate` and so on, recursively,\n | until the entire object has been validated.\n | \n | ----------------------------------------------------------------------\n | Data descriptors inherited from PlotlyDict:\n | \n | __dict__\n | dictionary for instance variables (if defined)\n | \n | __weakref__\n | list of weak references to the object (if defined)\n | \n | ----------------------------------------------------------------------\n | Methods inherited from __builtin__.dict:\n | \n | __cmp__(...)\n | x.__cmp__(y) <==> cmp(x,y)\n | \n | __contains__(...)\n | D.__contains__(k) -> True if D has a key k, else False\n | \n | __delitem__(...)\n | x.__delitem__(y) <==> del x[y]\n | \n | __eq__(...)\n | x.__eq__(y) <==> x==y\n | \n | __ge__(...)\n | x.__ge__(y) <==> x>=y\n | \n | __getattribute__(...)\n | x.__getattribute__('name') <==> x.name\n | \n | __getitem__(...)\n | x.__getitem__(y) <==> x[y]\n | \n | __gt__(...)\n | x.__gt__(y) <==> x>y\n | \n | __iter__(...)\n | x.__iter__() <==> iter(x)\n | \n | __le__(...)\n | x.__le__(y) <==> x<=y\n | \n | __len__(...)\n | x.__len__() <==> len(x)\n | \n | __lt__(...)\n | x.__lt__(y) <==> x<y\n | \n | __ne__(...)\n | x.__ne__(y) <==> x!=y\n | \n | __repr__(...)\n | x.__repr__() <==> repr(x)\n | \n | __sizeof__(...)\n | D.__sizeof__() -> size of D in memory, in bytes\n | \n | clear(...)\n | D.clear() -> None. Remove all items from D.\n | \n | copy(...)\n | D.copy() -> a shallow copy of D\n | \n | fromkeys(...)\n | dict.fromkeys(S[,v]) -> New dict with keys from S and values equal to v.\n | v defaults to None.\n | \n | get(...)\n | D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None.\n | \n | has_key(...)\n | D.has_key(k) -> True if D has a key k, else False\n | \n | items(...)\n | D.items() -> list of D's (key, value) pairs, as 2-tuples\n | \n | iteritems(...)\n | D.iteritems() -> an iterator over the (key, value) items of D\n | \n | iterkeys(...)\n | D.iterkeys() -> an iterator over the keys of D\n | \n | itervalues(...)\n | D.itervalues() -> an iterator over the values of D\n | \n | keys(...)\n | D.keys() -> list of D's keys\n | \n | pop(...)\n | D.pop(k[,d]) -> v, remove specified key and return the corresponding value.\n | If key is not found, d is returned if given, otherwise KeyError is raised\n | \n | popitem(...)\n | D.popitem() -> (k, v), remove and return some (key, value) pair as a\n | 2-tuple; but raise KeyError if D is empty.\n | \n | setdefault(...)\n | D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D\n | \n | values(...)\n | D.values() -> list of D's values\n | \n | viewitems(...)\n | D.viewitems() -> a set-like object providing a view on D's items\n | \n | viewkeys(...)\n | D.viewkeys() -> a set-like object providing a view on D's keys\n | \n | viewvalues(...)\n | D.viewvalues() -> an object providing a view on D's values\n | \n | ----------------------------------------------------------------------\n | Data and other attributes inherited from __builtin__.dict:\n | \n | __hash__ = None\n | \n | __new__ = <built-in method __new__ of type object>\n | T.__new__(S, ...) -> a new object with type S, a subtype of T\n\n"}], "metadata": {"collapsed": false, "trusted": true}}, {"execution_count": null, "cell_type": "code", "source": "# also lives at https://plot.ly/python/reference", "outputs": [], "metadata": {"collapsed": true, "trusted": true}}], "nbformat": 4, "metadata": {"kernelspec": {"display_name": "Python 2", "name": "python2", "language": "python"}, "language_info": {"mimetype": "text/x-python", "nbconvert_exporter": "python", "version": "2.7.9", "name": "python", "file_extension": ".py", "pygments_lexer": "ipython2", "codemirror_mode": {"version": 2, "name": "ipython"}}}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment