{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import pandas as pd\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"import plotly.plotly as py\n",
"\n",
"%matplotlib inline\n",
"\n",
"# sign into the plotly api\n",
"py.sign_in(\"\", \"\")\n",
"\n",
"# create some random dataframes\n",
"dates = pd.date_range('1/1/2000', periods=8)\n",
"df1 = pd.DataFrame(np.random.randn(8, 1), index=dates, columns=['A'])\n",
"df2 = pd.DataFrame(np.random.randn(8, 1), index=dates, columns=['B'])"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/plain": [
""
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"fig, ax = plt.subplots(1,1)\n",
"\n",
"df1.plot(y='A', ax=ax)\n",
"df2.plot(y='B', ax=ax)\n",
"\n",
"py.iplot_mpl(fig, filename='random')"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/plain": [
""
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"update = dict(\n",
" layout=dict(\n",
" showlegend=True # show legend \n",
" )\n",
")\n",
"py.iplot_mpl(fig, update=update, filename='random-with-legend')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"language": "python",
"name": "python2"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.6"
}
},
"nbformat": 4,
"nbformat_minor": 0
}