diff --git a/_posts/python/report-generation/2015-06-30-email-reports.html b/_posts/python/report-generation/2015-06-30-email-reports.html index 9d4ef83804ff..153e96436def 100755 --- a/_posts/python/report-generation/2015-06-30-email-reports.html +++ b/_posts/python/report-generation/2015-06-30-email-reports.html @@ -1,18 +1,15 @@ --- -permalink: python/email-reports/ +permalink: /python/email-reports description: How to email Plotly graphs in HTML reports with Python. name: Emailing Plotly Graphs with Python -has_thumbnail: true -thumbnail: thumbnail/ipython_10_email_report.jpg +has_thumbnail: false +thumbnail: /images/static-image layout: user-guide -page_type: example_index -display_as: report_generation -order: 3 +page_type: u-guide language: python --- -{% raw %} -
# The public plotly graphs to include in the email. These can also be generated with `py.plot(figure, filename)`
+# The public plotly graphs to include in the email. These can also be generated with `py.plot(figure, filename)`
graphs = [
- 'https://plot.ly/~christopherp/308',
- 'https://plot.ly/~christopherp/306',
- 'https://plot.ly/~christopherp/300',
- 'https://plot.ly/~christopherp/296'
+ 'https://plot.ly/~christopherp/308',
+ 'https://plot.ly/~christopherp/306',
+ 'https://plot.ly/~christopherp/300',
+ 'https://plot.ly/~christopherp/296'
]
@@ -60,27 +56,27 @@ Part 1 - An email templateIn [2]:
from IPython.display import display, HTML
-
-template = (''
- '<a href="{graph_url}" target="_blank">' # Open the interactive graph when you click on the image
- '<img src="{graph_url}.png">' # Use the ".png" magic url so that the latest, most-up-to-date image is included
- '</a>'
- '{caption}' # Optional caption to include below the graph
- '<br>' # Line break
- '<a href="{graph_url}" style="color: rgb(190,190,190); text-decoration: none; font-weight: 200;" target="_blank">'
- 'Click to comment and see the interactive graph' # Direct readers to Plotly for commenting, interactive graph
- '</a>'
- '<br>'
- '<hr>' # horizontal line
-'')
-
-email_body = ''
+from IPython.display import display, HTML
+
+template = (''
+ '<a href="{graph_url}" target="_blank">' # Open the interactive graph when you click on the image
+ '<img src="{graph_url}.png">' # Use the ".png" magic url so that the latest, most-up-to-date image is included
+ '</a>'
+ '{caption}' # Optional caption to include below the graph
+ '<br>' # Line break
+ '<a href="{graph_url}" style="color: rgb(190,190,190); text-decoration: none; font-weight: 200;" target="_blank">'
+ 'Click to comment and see the interactive graph' # Direct readers to Plotly for commenting, interactive graph
+ '</a>'
+ '<br>'
+ '<hr>' # horizontal line
+'')
+
+email_body = ''
for graph in graphs:
_ = template
- _ = _.format(graph_url=graph, caption='')
+ _ = _.format(graph_url=graph, caption='')
email_body += _
-
+
display(HTML(email_body))
@@ -92,7 +88,11 @@ Part 1 - An email template
-
+
+
+
+
+