Skip to content
This repository has been archived by the owner on Jan 13, 2024. It is now read-only.

Commit

Permalink
plug all libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
sdpython committed Jun 13, 2016
1 parent 57d8064 commit 35d8323
Show file tree
Hide file tree
Showing 26 changed files with 4,708 additions and 385 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -251,3 +251,4 @@ _doc/notebooks/2016/pydata/.ipynb_checkpoints/*
_doc/notebooks/2016/pydata/histogram_single.html
_doc/notebooks/2016/pydata/les_mis.html
_doc/notebooks/2016/pydata/panning.html
_doc/notebooks/2016/pydata/https!!raw-githubusercontent-com!andrea-cuttone!geoplotlib!master!examples!data!bus-csv
284 changes: 229 additions & 55 deletions _doc/notebooks/2016/pydata/10_plotting_libraries.ipynb

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions _doc/notebooks/2016/pydata/bar_chart.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
293 changes: 293 additions & 0 deletions _doc/notebooks/2016/pydata/gui_geoplotlib.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,293 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# geoplotlib"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"[geoplotlib](https://github.com/andrea-cuttone/geoplotlib) implements its own GUI to visualize maps.\n",
"\n",
"[documentation](http://andreacuttone.com/geoplotlib/api.html) [source](https://github.com/andrea-cuttone/geoplotlib) [installation](https://pypi.python.org/pypi/geoplotlib) [tutorial](https://github.com/andrea-cuttone/geoplotlib/tree/master/examples) "
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
"<div id=\"my_id_menu_nb\">run previous cell, wait for 2 seconds</div>\n",
"<script>\n",
"function repeat_indent_string(n){\n",
" var a = \"\" ;\n",
" for ( ; n > 0 ; --n) {\n",
" a += \" \";\n",
" }\n",
" return a;\n",
"}\n",
"var update_menu_string = function(begin, lfirst, llast, sformat, send, keep_item) {\n",
" var anchors = document.getElementsByClassName(\"section\");\n",
" if (anchors.length == 0) {\n",
" anchors = document.getElementsByClassName(\"text_cell_render rendered_html\");\n",
" }\n",
" var i,t;\n",
" var text_menu = begin;\n",
" var text_memo = \"<pre>\\nlength:\" + anchors.length + \"\\n\";\n",
" var ind = \"\";\n",
" var memo_level = 1;\n",
" var href;\n",
" var tags = [];\n",
" var main_item = 0;\n",
" for (i = 0; i <= llast; i++) {\n",
" tags.push(\"h\" + i);\n",
" }\n",
"\n",
" for (i = 0; i < anchors.length; i++) {\n",
" text_memo += \"**\" + anchors[i].id + \"--\\n\";\n",
"\n",
" var child = null;\n",
" for(t = 0; t < tags.length; t++) {\n",
" var r = anchors[i].getElementsByTagName(tags[t]);\n",
" if (r.length > 0) {\n",
"child = r[0];\n",
"break;\n",
" }\n",
" }\n",
" if (child == null){\n",
" text_memo += \"null\\n\";\n",
" continue;\n",
" }\n",
" if (anchors[i].hasAttribute(\"id\")) {\n",
" // when converted in RST\n",
" href = anchors[i].id;\n",
" text_memo += \"#1-\" + href;\n",
" // passer à child suivant (le chercher)\n",
" }\n",
" else if (child.hasAttribute(\"id\")) {\n",
" // in a notebook\n",
" href = child.id;\n",
" text_memo += \"#2-\" + href;\n",
" }\n",
" else {\n",
" text_memo += \"#3-\" + \"*\" + \"\\n\";\n",
" continue;\n",
" }\n",
" var title = child.textContent;\n",
" var level = parseInt(child.tagName.substring(1,2));\n",
"\n",
" text_memo += \"--\" + level + \"?\" + lfirst + \"--\" + title + \"\\n\";\n",
"\n",
" if ((level < lfirst) || (level > llast)) {\n",
" continue ;\n",
" }\n",
" if (title.endsWith('¶')) {\n",
" title = title.substring(0,title.length-1).replace(\"<\", \"&lt;\").replace(\">\", \"&gt;\").replace(\"&\", \"&amp;\")\n",
" }\n",
"\n",
" if (title.length == 0) {\n",
" continue;\n",
" }\n",
"\n",
" while (level < memo_level) {\n",
" text_menu += \"</ul>\\n\";\n",
" memo_level -= 1;\n",
" }\n",
" if (level == lfirst) {\n",
" main_item += 1;\n",
" }\n",
" if (keep_item != -1 && main_item != keep_item + 1) {\n",
" // alert(main_item + \" - \" + level + \" - \" + keep_item);\n",
" continue;\n",
" }\n",
" while (level > memo_level) {\n",
" text_menu += \"<ul>\\n\";\n",
" memo_level += 1;\n",
" }\n",
" text_menu += repeat_indent_string(level-2) + sformat.replace(\"__HREF__\", href).replace(\"__TITLE__\", title);\n",
" }\n",
" while (1 < memo_level) {\n",
" text_menu += \"</ul>\\n\";\n",
" memo_level -= 1;\n",
" }\n",
" text_menu += send;\n",
" //text_menu += \"\\n\" + text_memo;\n",
" return text_menu;\n",
"};\n",
"var update_menu = function() {\n",
" var sbegin = \"\";\n",
" var sformat = '<li><a href=\"#__HREF__\">__TITLE__</a></li>';\n",
" var send = \"\";\n",
" var keep_item = -1;\n",
" var text_menu = update_menu_string(sbegin, 2, 4, sformat, send, keep_item);\n",
" var menu = document.getElementById(\"my_id_menu_nb\");\n",
" menu.innerHTML=text_menu;\n",
"};\n",
"window.setTimeout(update_menu,2000);\n",
" </script>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from pyquickhelper.ipythonhelper import add_notebook_menu\n",
"add_notebook_menu()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## example"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"'./https!!raw-githubusercontent-com!andrea-cuttone!geoplotlib!master!examples!data!bus-csv'"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from pyquickhelper.loghelper import download\n",
"bus = download(\"https://raw.githubusercontent.com/andrea-cuttone/geoplotlib/master/examples/data/bus.csv\")\n",
"bus"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>name</th>\n",
" <th>lat</th>\n",
" <th>lon</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>Rådhuspassagen</td>\n",
" <td>55.743933</td>\n",
" <td>12.493921</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>Fortvej (Rødovre)</td>\n",
" <td>55.695224</td>\n",
" <td>12.448593</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" name lat lon\n",
"0 Rådhuspassagen 55.743933 12.493921\n",
"1 Fortvej (Rødovre) 55.695224 12.448593"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from pandas import read_csv\n",
"data = read_csv(bus)\n",
"data.head(n=2)"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"GDI+ cannot load 'C:\\\\Users\\\\xadupre/geoplotlib_tiles/mapquest/6/35/20.png'\n"
]
}
],
"source": [
"import geoplotlib\n",
"geoplotlib.dot(data)\n",
"geoplotlib.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.0"
},
"widgets": {
"state": {},
"version": "1.1.2"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
Binary file added _doc/notebooks/2016/pydata/img_bqplot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _doc/notebooks/2016/pydata/img_geoplotlib.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _doc/notebooks/2016/pydata/img_missingno.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _doc/notebooks/2016/pydata/img_vega.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 35d8323

Please sign in to comment.