\n",
" "
],
"metadata": {},
"output_type": "display_data",
"text": [
"
"
]
}
],
"prompt_number": 2
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"display_charts(df, chart_type=\"stock\", title=\"Germany inflation rate\")"
],
"language": "python",
"metadata": {},
"outputs": [
{
"html": [
"\n",
" "
],
"metadata": {},
"output_type": "display_data",
"text": [
"
"
]
}
],
"prompt_number": 3
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"display_charts(df, kind=\"bar\", title=\"Germany inflation rate\")"
],
"language": "python",
"metadata": {},
"outputs": [
{
"html": [
"\n",
" "
],
"metadata": {},
"output_type": "display_data",
"text": [
"
"
]
}
],
"prompt_number": 4
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"display_charts(df, kind=\"barh\", title=\"Germany inflation rate\")"
],
"language": "python",
"metadata": {},
"outputs": [
{
"html": [
"\n",
" "
],
"metadata": {},
"output_type": "display_data",
"text": [
"
"
]
}
],
"prompt_number": 5
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"display_charts(df, title=\"Germany inflation rate\", legend=None, kind=\"bar\", figsize = (400, 200))"
],
"language": "python",
"metadata": {},
"outputs": [
{
"html": [
"\n",
" "
],
"metadata": {},
"output_type": "display_data",
"text": [
"
"
]
}
],
"prompt_number": 6
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"display_charts(df, title=\"Germany inflation rate\", kind=\"bar\", render_to=\"chart5\", zoom=\"xy\")"
],
"language": "python",
"metadata": {},
"outputs": [
{
"html": [
"\n",
" "
],
"metadata": {},
"output_type": "display_data",
"text": [
"
"
]
}
],
"prompt_number": 7
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"df = pd.DataFrame([\n",
" {\"a\": 1, \"b\": 2, \"c\": 3, \"t\": datetime.datetime(2015, 1, 1, 0)},\n",
" {\"a\": 2, \"b\": 4, \"c\": 6, \"t\": datetime.datetime(2015, 1, 1, 1)}\n",
"])\n",
"display_charts(df, x=\"t\", y=[\"a\", \"c\"], kind=\"bar\")"
],
"language": "python",
"metadata": {},
"outputs": [
{
"html": [
"\n",
" "
],
"metadata": {},
"output_type": "display_data",
"text": [
"
"
]
}
],
"prompt_number": 8
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Get Serialized Data an Plot with the IPython Display Feature"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"data = serialize(df, render_to=\"chart1\", kind=\"barh\", output_type=\"json\")"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 9
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"data.keys()"
],
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 10,
"text": [
"['series', 'yAxis', 'chart', 'xAxis', 'legend']"
]
}
],
"prompt_number": 10
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"data"
],
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 11,
"text": [
"{'chart': {'renderTo': 'chart1', 'type': 'bar'},\n",
" 'legend': {'enabled': True},\n",
" 'series': [{'data': [(0, 1), (1, 2)], 'name': 'a', 'yAxis': 0},\n",
" {'data': [(0, 3), (1, 6)], 'name': 'c', 'yAxis': 0},\n",
" {'data': [(0, 2), (1, 4)], 'name': 'b', 'yAxis': 0}],\n",
" 'xAxis': {},\n",
" 'yAxis': [{}]}"
]
}
],
"prompt_number": 11
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"js_data = serialize(df, render_to=\"chart1\", kind=\"barh\")"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 12
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Use the display HTML IPython feature."
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"display(HTML(\"\"\"\n",
"\n",
"\n",
"\"\"\" % locals()))"
],
"language": "python",
"metadata": {},
"outputs": [
{
"html": [
"\n",
"\n",
"\n"
],
"metadata": {},
"output_type": "display_data",
"text": [
""
]
}
],
"prompt_number": 13
}
],
"metadata": {}
}
]
}