In [1]:
import plotly
plotly.__version__
Out[1]:
'1.0.33'
In [2]:
import plotly.plotly as py
import plotly.tools as tls
from plotly.graph_objs import *
help(Marker)
Help on class Marker in module plotly.graph_objs.graph_objs:

class Marker(PlotlyDict)
 |  A dictionary-like object representing marker(s) style in plotly.
 |  
 |      
 |  Quick method reference:
 |  
 |      Marker.update(changes)
 |      Marker.strip_style()
 |      Marker.get_data()
 |      Marker.to_graph_objs()
 |      Marker.validate()
 |      Marker.to_string()
 |      Marker.force_clean()
 |  
 |  Valid keys:
 |  
 |      color [required=False] (value=array-like of string describing color):
 |          Sets the color of the face of the marker object. If 'color' is
 |          linked to a list or an array of numbers, color values are mapped to
 |          individual marker points in the same order as in the data lists or
 |          arrays. To set the color of the marker's bordering line, use the
 |          'line' key in Marker.
 |  
 |          Examples:
 |              ["'green'", "'rgb(0, 255, 0)'", "'rgba(0, 255, 0, 0.3)'",
 |              "'hsl(120,100%,50%)'", "'hsla(120,100%,50%,0.3)'"]
 |  
 |      size [required=False] (value=number: x > 0, or list of these numbers):
 |          Sets the size of the markers (in pixels). If 'size' is linked to a
 |          list or an array of numbers, size values are mapped to individual
 |          marker points in the same order as in the data lists or arrays.
 |  
 |      symbol [required=False] (value='dot' | 'cross' | 'diamond' | 'square' |
 |      'triangle-down' | 'triangle-left' | 'triangle-right' | 'triangle-up' |
 |      'x' OR list of these string values):
 |          The symbol that is drawn on the plot for each marker. Supported only
 |          in scatter trace. If 'symbol' is linked to a list or an array of
 |          numbers, symbol values are mapped to individual marker points in the
 |          same order as in the data lists or arrays.
 |  
 |      line [required=False] (value=Line object | dictionary-like):
 |          A dictionary-like object describing the line belonging to the
 |          marker. For example, the line around each point in a scatter trace
 |          or the line around each bar in a bar trace.
 |  
 |          For more, run `help(plotly.graph_objs.Line)`
 |  
 |      opacity [required=False] (value=number: x in [0, 1], or list of these
 |      numbers):
 |          Sets the opacity, or transparency also known as the alpha channel of
 |          colors) of the marker points. If the marker points' color is given
 |          in terms of 'rgba' color model, this does not need to be defined. If
 |          'opacity' is linked to a list or an array of numbers, opacity values
 |          are mapped to individual marker points in the same order as in the
 |          data lists or arrays.
 |  
 |      colorscale [required=False] (value=array_like of value-color pairs |
 |      'Greys' | 'Greens' | 'Bluered' | 'Hot' | 'Picnic' | 'Portland' | 'Jet' |
 |      'RdBu' | 'Blackbody' | 'Earth' | 'Electric' | 'YIOrRd' | 'YIGnBu'):
 |          The color scale. The strings are pre-defined color scales. For
 |          custom color scales, define a list of color-value pairs, where the
 |          first element of the pair corresponds to a normalized value of the y
 |          coordinates (for scatter traces) from 0-1 and the second element of
 |          pair corresponds to a color.
 |  
 |      sizemode [required=False] (value='diameter' | 'area'):
 |          Scale the size each points with respect to diameter or area. Applies
 |          only to scatter traces.
 |  
 |      sizeref [required=False] (value=number: x >= 0):
 |          Select scale factor for the size of each point. Applies only to
 |          scatter traces.
 |  
 |      maxdisplayed [required=False] (value=number: x >= 0):
 |          Set maximum number of displayed points for this trace. Applies only
 |          to scatter traces.
 |  
 |  Method resolution order:
 |      Marker
 |      PlotlyDict
 |      __builtin__.dict
 |      __builtin__.object
 |  
 |  Methods inherited from PlotlyDict:
 |  
 |  __init__(self, *args, **kwargs)
 |  
 |  force_clean(self, caller=True)
 |      Attempts to convert to graph_objs and call force_clean() on values.
 |      
 |      Calling force_clean() on a PlotlyDict will ensure that the object is
 |      valid and may be sent to plotly. This process will also remove any
 |      entries that end up with a length == 0.
 |      
 |      Careful! This will delete any invalid entries *silently*.
 |  
 |  get_data(self)
 |      Returns the JSON for the plot with non-data elements stripped.
 |  
 |  get_ordered(self, caller=True)
 |  
 |  strip_style(self)
 |      Strip style from the current representation.
 |      
 |      All PlotlyDicts and PlotlyLists are guaranteed to survive the
 |      stripping process, though they made be left empty. This is allowable.
 |      
 |      Keys that will be stripped in this process are tagged with
 |      `'type': 'style'` in the INFO dictionary listed in graph_objs_meta.py.
 |      
 |      This process first attempts to convert nested collections from dicts
 |      or lists to subclasses of PlotlyList/PlotlyDict. This process forces
 |      a validation, which may throw exceptions.
 |      
 |      Then, each of these objects call `strip_style` on themselves and so
 |      on, recursively until the entire structure has been validated and
 |      stripped.
 |  
 |  to_graph_objs(self, caller=True)
 |      Walk obj, convert dicts and lists to plotly graph objs.
 |      
 |      For each key in the object, if it corresponds to a special key that
 |      should be associated with a graph object, the ordinary dict or list
 |      will be reinitialized as a special PlotlyDict or PlotlyList of the
 |      appropriate `kind`.
 |  
 |  to_string(self, level=0, indent=4, eol='\n', pretty=True, max_chars=80)
 |      Returns a formatted string showing graph_obj constructors.
 |      
 |              Example:
 |      
 |                  print obj.to_string()
 |      
 |              Keyword arguments:
 |              level (default = 0) -- set number of indentations to start with
 |              indent (default = 4) -- set indentation amount
 |              eol (default = '
 |      ') -- set end of line character(s)
 |              pretty (default = True) -- curtail long list output with a '...'
 |              max_chars (default = 80) -- set max characters per line
 |  
 |  update(self, dict1=None, **dict2)
 |      Update current dict with dict1 and then dict2.
 |      
 |      This recursively updates the structure of the original dictionary-like
 |      object with the new entries in the second and third objects. This
 |      allows users to update with large, nested structures.
 |      
 |      Note, because the dict2 packs up all the keyword arguments, you can
 |      specify the changes as a list of keyword agruments.
 |      
 |      Examples:
 |      # update with dict
 |      obj = Layout(title='my title', xaxis=XAxis(range=[0,1], domain=[0,1]))
 |      update_dict = dict(title='new title', xaxis=dict(domain=[0,.8]))
 |      obj.update(update_dict)
 |      obj
 |      {'title': 'new title', 'xaxis': {'range': [0,1], 'domain': [0,.8]}}
 |      
 |      # update with list of keyword arguments
 |      obj = Layout(title='my title', xaxis=XAxis(range=[0,1], domain=[0,1]))
 |      obj.update(title='new title', xaxis=dict(domain=[0,.8]))
 |      obj
 |      {'title': 'new title', 'xaxis': {'range': [0,1], 'domain': [0,.8]}}
 |      
 |      This 'fully' supports duck-typing in that the call signature is
 |      identical, however this differs slightly from the normal update
 |      method provided by Python's dictionaries.
 |  
 |  validate(self, caller=True)
 |      Recursively check the validity of the keys in a PlotlyDict.
 |      
 |      The valid keys constitute the entries in each object
 |      dictionary in INFO stored in graph_objs_meta.py.
 |      
 |      The validation process first requires that all nested collections be
 |      converted to the appropriate subclass of PlotlyDict/PlotlyList. Then,
 |      each of these objects call `validate` and so on, recursively,
 |      until the entire object has been validated.
 |  
 |  ----------------------------------------------------------------------
 |  Data descriptors inherited from PlotlyDict:
 |  
 |  __dict__
 |      dictionary for instance variables (if defined)
 |  
 |  __weakref__
 |      list of weak references to the object (if defined)
 |  
 |  ----------------------------------------------------------------------
 |  Data and other attributes inherited from PlotlyDict:
 |  
 |  __metaclass__ = <class 'plotly.graph_objs.graph_objs.DictMeta'>
 |      A meta class for PlotlyDict class creation.
 |      
 |      The sole purpose of this meta class is to properly create the __doc__
 |      attribute so that running help(Obj), where Obj is a subclass of PlotlyDict,
 |      will return information about key-value pairs for that object.
 |  
 |  ----------------------------------------------------------------------
 |  Methods inherited from __builtin__.dict:
 |  
 |  __cmp__(...)
 |      x.__cmp__(y) <==> cmp(x,y)
 |  
 |  __contains__(...)
 |      D.__contains__(k) -> True if D has a key k, else False
 |  
 |  __delitem__(...)
 |      x.__delitem__(y) <==> del x[y]
 |  
 |  __eq__(...)
 |      x.__eq__(y) <==> x==y
 |  
 |  __ge__(...)
 |      x.__ge__(y) <==> x>=y
 |  
 |  __getattribute__(...)
 |      x.__getattribute__('name') <==> x.name
 |  
 |  __getitem__(...)
 |      x.__getitem__(y) <==> x[y]
 |  
 |  __gt__(...)
 |      x.__gt__(y) <==> x>y
 |  
 |  __iter__(...)
 |      x.__iter__() <==> iter(x)
 |  
 |  __le__(...)
 |      x.__le__(y) <==> x<=y
 |  
 |  __len__(...)
 |      x.__len__() <==> len(x)
 |  
 |  __lt__(...)
 |      x.__lt__(y) <==> x<y
 |  
 |  __ne__(...)
 |      x.__ne__(y) <==> x!=y
 |  
 |  __repr__(...)
 |      x.__repr__() <==> repr(x)
 |  
 |  __setitem__(...)
 |      x.__setitem__(i, y) <==> x[i]=y
 |  
 |  __sizeof__(...)
 |      D.__sizeof__() -> size of D in memory, in bytes
 |  
 |  clear(...)
 |      D.clear() -> None.  Remove all items from D.
 |  
 |  copy(...)
 |      D.copy() -> a shallow copy of D
 |  
 |  fromkeys(...)
 |      dict.fromkeys(S[,v]) -> New dict with keys from S and values equal to v.
 |      v defaults to None.
 |  
 |  get(...)
 |      D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None.
 |  
 |  has_key(...)
 |      D.has_key(k) -> True if D has a key k, else False
 |  
 |  items(...)
 |      D.items() -> list of D's (key, value) pairs, as 2-tuples
 |  
 |  iteritems(...)
 |      D.iteritems() -> an iterator over the (key, value) items of D
 |  
 |  iterkeys(...)
 |      D.iterkeys() -> an iterator over the keys of D
 |  
 |  itervalues(...)
 |      D.itervalues() -> an iterator over the values of D
 |  
 |  keys(...)
 |      D.keys() -> list of D's keys
 |  
 |  pop(...)
 |      D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
 |      If key is not found, d is returned if given, otherwise KeyError is raised
 |  
 |  popitem(...)
 |      D.popitem() -> (k, v), remove and return some (key, value) pair as a
 |      2-tuple; but raise KeyError if D is empty.
 |  
 |  setdefault(...)
 |      D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D
 |  
 |  values(...)
 |      D.values() -> list of D's values
 |  
 |  viewitems(...)
 |      D.viewitems() -> a set-like object providing a view on D's items
 |  
 |  viewkeys(...)
 |      D.viewkeys() -> a set-like object providing a view on D's keys
 |  
 |  viewvalues(...)
 |      D.viewvalues() -> an object providing a view on D's values
 |  
 |  ----------------------------------------------------------------------
 |  Data and other attributes inherited from __builtin__.dict:
 |  
 |  __hash__ = None
 |  
 |  __new__ = <built-in method __new__ of type object>
 |      T.__new__(S, ...) -> a new object with type S, a subtype of T

In [3]:
colorscale= [[0, "rgb(255,0,0)"],[0.066667,"rgb(204,0,0)"],[0.13333,"rgb(255,127,64)"],
[0.2,"rgb(255,85,0)"],[0.26667,"rgb(255,170,0)"],[0.33333,"rgb(255,255,0)"],[0.4,"rgb(128,255,0)"],
[0.46667,"rgb(0,255,0)"],[0.53333,"rgb(0,255,129)"],[0.6,"rgb(0,255,255)"],[0.66667,"rgb(0,170,255)"],
[0.73333,"rgb(0,62,255)"],[0.8,"rgb(115,0,230)"],[0.86667,"rgb(103,0,204)"],[0.93333,"rgb(77,0,153)"],
[1,"rgb(153,0,122)"]]
colorscale
Out[3]:
[[0, 'rgb(255,0,0)'],
 [0.066667, 'rgb(204,0,0)'],
 [0.13333, 'rgb(255,127,64)'],
 [0.2, 'rgb(255,85,0)'],
 [0.26667, 'rgb(255,170,0)'],
 [0.33333, 'rgb(255,255,0)'],
 [0.4, 'rgb(128,255,0)'],
 [0.46667, 'rgb(0,255,0)'],
 [0.53333, 'rgb(0,255,129)'],
 [0.6, 'rgb(0,255,255)'],
 [0.66667, 'rgb(0,170,255)'],
 [0.73333, 'rgb(0,62,255)'],
 [0.8, 'rgb(115,0,230)'],
 [0.86667, 'rgb(103,0,204)'],
 [0.93333, 'rgb(77,0,153)'],
 [1, 'rgb(153,0,122)']]
In [4]:
data = Data([
    Scatter(
        x=[0, 1, 2, 3],
        y=[0.2, 0.1, -0.3, 0.8],
        name='wave0',
        mode='markers',
        marker=Marker(
            symbol='dot',
            line=Line(
                color='rgb(0,254,254)',
                width=2
            ),
            size=21,
            color=[0.2, 0.1, -0.3, 0.8],
            colorscale=colorscale
        )
    )
])
In [5]:
py.iplot(data, filename='colorscale-test')
In [9]:
fig_get = py.get_figure("https://plot.ly/~etpinard/324/wave0/")

print fig_get.to_string()
Figure(
    data=Data([
        Scatter(
            x=[0, 1, 2, 3],
            y=[0.2, 0.1, -0.3, 0.8],
            mode='markers',
            name='wave0',
            marker=Marker(
                color=[0.2, 0.1, -0.3, 0.8],
                size=21,
                symbol='dot',
                line=Line(
                    color='rgb(0,254,254)',
                    width=2
                ),
                colorscale=[[0, 'rgb(255,0,0)'], [0.066667, 'rgb(204,0,0)']...]
            )
        )
    ])
)
In [7]:
py.iplot(fig_get, filename='colorscale-test-replay')



In [2]:
from IPython.display import display, HTML
import urllib2
url = 'https://raw.githubusercontent.com/plotly/python-user-guide/master/custom.css'
display(HTML(urllib2.urlopen(url).read()))