Skip to content

Instantly share code, notes, and snippets.

@seufagner
Created January 6, 2017 19:03
Show Gist options
  • Save seufagner/c06c6f52c590e7909667f78ebc96aa6d to your computer and use it in GitHub Desktop.
Save seufagner/c06c6f52c590e7909667f78ebc96aa6d to your computer and use it in GitHub Desktop.
show plots from matplotlib on zeppelin
%pyspark
import os
import matplotlib.pyplot as plt; plt.rcdefaults()
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import StringIO
import matplotlib
matplotlib.style.use('ggplot')
plt.rcdefaults()
plt.switch_backend('agg')
def show(p):
img = StringIO.StringIO()
p.savefig(img, format='svg')
img.seek(0)
print "%html <div style='width:600px'>" + img.buf + "</div>"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment