import plotly plotly.__version__ import plotly.plotly as py import plotly.tools as tls from plotly.graph_objs import * empet22 = py.get_figure("https://plot.ly/~empet/22/") print empet22.to_string() help(Annotation) # note that the next version of Plotly's Python API will have more extension # help() documentation for several graph object including Annotation anno_text = "Source: medalist birth dates on \ [1] and \ [2]" # (!) use " " to bound the text and ' ' to bound the hyperlinks # make sure that the string continues on the first column after the line breaks (\) annotation = Annotation( showarrow=False, # no arrow, making 'x' and 'y' are the coord of the text text=anno_text, # link the annotation text xref='paper', # (!) use 'paper' coordinates for both 'x' yref='paper', # and 'y' x=0, # (!) corresponds to left edge of plotting area y=1, # (1) " to top edge of plotting area xanchor='left', # (!) 'x' corresponds to the text's left edge yanchor='bottom', # (!) 'y' corresponds to the text's bottom edge font=Font( size=14 # increase the font size ) ) annotations = Annotations([annotation]) # Update figure object empet22['layout'].update(annotations=annotations) print empet22.to_string() # print updated figure object py.iplot(empet22, filename="empet22-with-annotation", height=810) # 'height' adjust the height of notebook iframe 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()))