This repository has been archived by the owner on Jan 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
4,708 additions
and
385 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
284 changes: 229 additions & 55 deletions
284
_doc/notebooks/2016/pydata/10_plotting_libraries.ipynb
Large diffs are not rendered by default.
Oops, something went wrong.
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(\"<\", \"<\").replace(\">\", \">\").replace(\"&\", \"&\")\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 | ||
} |
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.
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.
Oops, something went wrong.