ipython + jupyter + plotly (matplotlib) settings & usage notes

Convenient settings for yourself

Environment & Requirement

Setting

Make a set of ~ / .ipython / default_profile.

$ ipython create profile
c.InteractiveShellApp.extensions = ['autoreload']
c.InteractiveShellApp.exec_lines = ['%autoreload 2']
c.InteractiveShellApp.matplotlib = 'inline'
import numpy as np
import matplotlib.pyplot as plt
import plotly.offline as py
py.init_notebook_mode()
def plotly(f, *largs, **dargs):
    fig = plt.figure()
    f(*largs, **dargs)
    iplot_mpl(fig)

Sample

x = np.random.randn(10)
y = x+np.random.randn(10)*0.1
plotly(plt.plot,x,y,'bo')

I didn't feel like learning how to use plotly, so I wanted to make a wrapper for matplotlib with plotly. I couldn't think of an easy way to use higher-order functions. .. .. If you try to do something complicated, you can't use it. If you are a strong person who saw this, please let me know if there is any other good way. (It's true that you should learn how to use plotly ...)

I made py an alias according to the plotly sample, but I feel that it is too bullish to use it. .. .. w

Recommended Posts

ipython + jupyter + plotly (matplotlib) settings & usage notes
Jupyter, numpy, matplotlib notes used in reports
concurrent.futures Usage notes
iPython settings etc.
Graph drawing with jupyter (ipython notebook) + matplotlib + vagrant
Jupyter study notes_008
Jupyter study notes_004
Jupyter study notes_001
Jupyter Official DockerHub Notes
Candlestick with plotly + Jupyter
python decorator usage notes
[Python] pytest-mock Usage notes
matplotlib legend layout notes