from IPython.display import HTML
hide_me = ''
HTML('''
<style>
.container {
box-shadow: none !important;
}
.output_html {
shadow: none !important;
max-width: 100% !important;
padding: 0 !important;
}
.title1 {
color: #e74a49 !important;
}
</style>
<script async>
code_show=true;
function code_toggle() {
if (code_show) {
$('div.input').each(function(id) {
el = $(this).find('.cm-variable:first');
if (id == 0 || el.text() == 'hide_me') {
$(this).hide();
}
});
$('div.output_prompt').css('opacity', 0);
} else {
$('div.input').each(function(id) {
$(this).show();
});
$('div.output_prompt').css('opacity', 1);
}
code_show = !code_show
}
$( document ).ready(code_toggle);
</script>
<form action="javascript:code_toggle()"><input style="opacity:0" type="submit" value="Click here to toggle on/off the raw code."></form>''')
PyMaps
Styles
With styles is possbible to customize the presentation of the Google base maps, changing the visual display of such elements as roads, parks, and built-up areas. PyMaps has ten built-in styles. You can find more styles at Snazzymaps or make your own style.
import os
from pymaps.pymaps import Map
API_KEY = os.environ['MAPS_API_KEY']
map_settings = {'api_key': API_KEY,
'zoom': 12,
'disable_default_ui': True,
'show_pegman': False,
'show_zoom_control': True}
new_york = (40.7128, -74.0060)
Map(center=new_york, style='aubergine', **map_settings)
madrid = (40.4168, -3.7038)
Map(center=madrid, style='dark', **map_settings)
paris = (48.8566, 2.3522)
Map(center=paris, style='grayscale', **map_settings)
ottawa = (45.4215, -75.6972)
Map(center=ottawa, style='night', **map_settings)
jerusalem = (31.7683, 35.2137)
Map(center=jerusalem, style='old', **map_settings)
brasilia = (-15.79, -47.88)
Map(center=brasilia, style='redberry', **map_settings)
rome = (41.9028, 12.4964)
Map(center=rome, style='retro', **map_settings)
cape_town = (-33.9249, 18.4241)
Map(center=cape_town, style='silver', **map_settings)
sidney = (-33.8688, 151.2093)
Map(center=sidney, style='water', **map_settings)
beijing = (39.9042, 116.4074)
Map(center=beijing, style='wine', **map_settings)
GOLDEN = '#FFD700'
color_road = '''[
{{
"featureType": "road",
"elementType": "geometry",
"stylers": [
{{
"color": "{}"
}}
]
}}
]'''
Map(center=ottawa, style=color_road.format(GOLDEN), **map_settings)
no_labels = '''[
{
"featureType": "all",
"elementType": "labels",
"stylers": [
{ "visibility": "off" }
]
}
]'''
Map(center=ottawa, style=no_labels, **map_settings)