In the Plotly Webapp you can share your graphs over email to your colleagues who are also Plotly members. If your making graphs periodically or automatically, e.g. in Python with a cron job, it can be helpful to also share the graphs that you're creating in an email to your team.
This notebook is a primer on sending nice HTML emails with Plotly graphs in Python. We use:
smtplib
and email
libraries included in the Python standard library# This is a comment
from plotly.offline import iplot, init_notebook_mode
init_notebook_mode()
iplot([{'x': [1, 2, 3], 'y': [3, 1, 5]}])
If we use the same filename
, the graph will save to the same URL. So, if we include a graph in an email by it's URL, we can update that graph by calling py.plot
with the same filename.
for i in range(100):
print i
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
! pip install publisher --upgrade
from IPython.display import HTML, display
display(HTML('<link href="//fonts.googleapis.com/css?family=Open+Sans:600,400,300,200|Inconsolata|Ubuntu+Mono:400,700" rel="stylesheet" type="text/css" />'))
display(HTML('<link rel="stylesheet" type="text/css" href="https://help.plot.ly/documentation/all_static/css/ipython-notebook-custom.css">'))
import publisher
publisher.publish('style-template', '/python/style-template',
'Markdown CSS Style Template',
'Markdown CSS Style Template',
uses_plotly_offline=True, sitemap='false')
Requirement already up-to-date: publisher in /Users/chriddyp/Repos/venvpy27/lib/python2.7/site-packages