gmplot Google Maps html output not showing markers/heatmap - python-3.x

I am running gmplot in Pycharm (2018.1 Community) with Python Interpreter 3.5.4 (via Anaconda 1.5).
gmplot definitely creates the map.html, and the lat/longs are listed in the html.
However it does not appear to be plotting the lat/long on the image.
What am I missing?
Python Code:
gmap = gmplot.GoogleMapPlotter(lats[0],longs[0],15) #working
gmap.heatmap(lats, longs) #not working
gmap.draw('map.html')
HTML Output:
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Google Maps - pygmaps </title>
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?libraries=visualization&sensor=true_or_false"></script>
<script type="text/javascript">
function initialize() {
var centerlatlng = new google.maps.LatLng(40.218483, 29.042473);
var myOptions = {
zoom: 15,
center: centerlatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
var heatmap_points = [
new google.maps.LatLng(40.218483, 29.042473),
new google.maps.LatLng(40.218500, 29.042485),
###....(for the sake of brevity - removed)....
new google.maps.LatLng(40.220540, 29.043019),
new google.maps.LatLng(40.220569, 29.043032),
new google.maps.LatLng(nan, nan),
];
var pointArray = new google.maps.MVCArray(heatmap_points);
var heatmap;
heatmap = new google.maps.visualization.HeatmapLayer({
data: pointArray
});
heatmap.setMap(map);
heatmap.set('threshold', 10);
heatmap.set('radius', 10);
heatmap.set('opacity', 0.600000);
heatmap.set('dissipating', true);
}
</script>
</head>
<body style="margin:0px; padding:0px;" onload="initialize()">
<div id="map_canvas" style="width: 100%; height: 100%;"></div>
</body>
</html>
Image opened by browsing to the HTML file on my local machine: (no markers!)
Map
And when I try to open the html file direct from PyCharm, I get Javascript errors that look like this:
Firefox Javascript console
This happens regardless of whether I use gmplot.scatter or gmplot.heatmap.
Do I need to put an API key somewhere?
Any ideas?

Related

Azure Maps - Cannot see the map

I was following this tutorial
(https://learn.microsoft.com/en-us/learn/modules/create-your-first-iot-central-app/)
In unit 4, I followed all the steps but what I could see was just a blank page like this
Unit 4 exercise result
<!DOCTYPE html>
<html>
<head>
<title>Map</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Add references to the Azure Maps Map control JavaScript and CSS files. -->
<link rel="stylesheet" href="https://atlas.microsoft.com/sdk/javascript/mapcontrol/2/atlas.min.css" type="text/css">
<script src="https://atlas.microsoft.com/sdk/javascript/mapcontrol/2/atlas.min.js"></script>
<!-- Add a reference to the Azure Maps Services Module JavaScript file. -->
<script src="https://atlas.microsoft.com/sdk/javascript/mapcontrol/2/atlas-service.min.js"></script>
<script>
function GetMap() {
//Instantiate a map object
var map = new atlas.Map("myMap", {
//Add your Azure Maps subscription key to the map SDK. Get an Azure Maps key at https://azure.com/maps
authOptions: {
authType: 'subscriptionKey',
subscriptionKey: 'mB~~~~~~(I wrote my maps primary key here)'
}
});
}
</script>
<style>
html,
body {
width: 100%;
height: 100%;
padding: 0;
margin: 0;
}
#myMap {
width: 100%;
height: 100%;
}
</style>
</head>
<body onload="GetMap()">
<div id="myMap"></div>
</body>
</html>
Azure Maps Resource
This feedback page also doesn't work...
(https://feedback.azuremaps.com/)
Feedback Maps
Also, in this website, when I press "Open In New Tab", I cannot see anything...
(https://azuremapscodesamples.azurewebsites.net/)
Code samples Maps
I had spent almost 4 hours but couldn't find out the solution...
What should I need to do to see proper Maps on those pages?
If all the different sites that use Azure Maps doesn't work for you its likely one of the following reasons:
Make sure you are in a supported region. Azure Maps is not available to users who are located in China or South Korea, and the requests to the platform are actively blocked.
You are using an unsupported browser: https://learn.microsoft.com/en-us/azure/azure-maps/supported-browsers
WebGL is either disabled in your browser, or isn't working. Try this sample: https://azuremapscodesamples.azurewebsites.net/Map/Detect%20if%20browser%20is%20supported.html
Your graphic card has issues, try updating the drivers.
check how the map starts
$(document).ready(function () {
InitMap();
});
function InitMap() {
var map = new atlas.Map('myMap', {
center: [-73.98235, 40.76799],
zoom: 10,
language: 'en-US',
authOptions: {
authType: 'subscriptionKey',
subscriptionKey: 'key1*****'
}
});
}
$(document).ready(function () {
InitMap();
});

Simple SVG project cause error on Internet Explorer 11

I am learning svg and would like to compare displaying svg items on different browsers. My code works fine on firefox, chrome, edge, safari etc, but cannot work on ie11. Unfortunately application I develop needs to support ie11 so I need to force my code to work correctly.
Here is fiddle: https://jsbin.com/hemawaboqa/1/edit?html,js,output
HTML
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/#svgdotjs/svg.js"></script>
</head>
<body>
<div style="position:absolute;left:0px;top:0px;right:0px;bottom:0px;overflow:hidden;" id="svg-main-container">
<div style="position:absolute;left:0px;top:0px;bottom:0px;right:300px;border:1px solid #dadada;overflow:auto;" id="svg-canvas"></div>
</div>
</body>
</html>
JS
var draw = SVG().addTo('#svg-canvas').size(400, 400)
var rect = draw.rect(100, 100)
Why that code is not working on ie11?
I have created a sample using the SVG.js 3.0 version with your code, it will show the "Object doesn't support property or method 'from'" in IE11 browser, perhaps the issue is related to the svg.js version, and it is a plugin issue, you could feedback this issue to SVG.js forum.
Besides, I suggest you could refer to the following code, to use the old version of SVG.js:
<!DOCTYPE html>
<html lang=en-us>
<head>
<meta charset=utf-8>
<title>TEST</title>
</head>
<body>
<div style="position:absolute;left:0px;top:0px;right:0px;bottom:0px;overflow:hidden;" id="svg-main-container">
<div style="position:absolute;left:0px;top:0px;bottom:0px;right:300px;border:1px solid #dadada;overflow:auto;" id="drawing">
</div>
</div>
<script src=https://cdnjs.cloudflare.com/ajax/libs/svg.js/2.6.6/svg.min.js></script>
<script>
(function () {
'use strict';
// Add title as first child of SVG element:
var createTitle = function (svgObject, text) {
var fragment = document.createDocumentFragment();
var titleElement = document.createElement('TITLE');
fragment.appendChild(titleElement);
titleElement.innerHTML = text;
svgObject.node.insertAdjacentElement('afterbegin', titleElement);
};
SVG.extend(SVG.Doc, {
namespace: function () {
return this
.attr({xmlns: 'http://www.w3.org/2000/svg', version: '1.1'})
.attr('xmlns:xlink', SVG.xlink, SVG.xmlns);
}
});
var draw = new SVG('drawing').size(300, 300);
var rect = draw.rect(100, 100).attr({fill: '#f06'});
// Add title to SVG element
createTitle(draw, 'Rectangle');
}());
</script>
</body>
</html>
The result as below:
The library you are using has ECMA 6 elements that are not understood in IE.
If you need your project to work in IE, you will have to use another library or find out how to change it so it allows for older browsers (as suggested here: https://svgjs.dev/docs/3.0/compatibility/)

Bokeh is not generating plot and is instead returning an HTML file

I am new to Python and was trying out the Bokeh library. I try to plot a basic line graph and instead of returning the graph I get an ouput HTML file. When I ran the HTML code it looks like the graph does generate. Does anyone have any idea why the show() method is not showing me the chart as expected. I tried this in both Jupyter Notebook as well as Atom and both return the HTML code. I am running Windows 7 as well.
My code:
from bokeh.plotting import figure
from bokeh.io import output_file , show
x=[1,2,3,4,5]
y=[6,7,8,9,10]
output_file("test1.html")
f=figure()
f.line(x,y)
show(f)
Returned HTML file:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Bokeh Plot</title>
<link rel="stylesheet" href="https://cdn.bokeh.org/bokeh/release/bokeh-0.13.0.min.css" type="text/css" />
<script type="text/javascript" src="https://cdn.bokeh.org/bokeh/release/bokeh-0.13.0.min.js"></script>
<script type="text/javascript">
Bokeh.set_log_level("info");
</script>
</head>
<body>
<div class="bk-root" id="d48bbd43-55c8-4727-befa-468754bdb0b5"></div>
<script type="application/json" id="41bd10a1-5a61-4504-80f1-8c56f40e644b">
{"c99a857f-320f-48ba-8576-3ef2bd47c6ce":{"roots":{"references":[{"attributes":{},"id":"c17f31c6-ea53-4bda-b425-65e087f9b126","type":"SaveTool"},{"attributes":{},"id":"d5662033-1332-448f-8078-b1b5fc6ebedd","type":"ResetTool"},{"attributes":{"overlay":{"id":"647df24a-7a53-48f7-850b-e99faaf7e12c","type":"BoxAnnotation"}},"id":"2ebb0a9b-1f3e-4e0e-b54c-dab483d9ad1d","type":"BoxZoomTool"},{"attributes":{"active_drag":"auto","active_inspect":"auto","active_multi":null,"active_scroll":"auto","active_tap":"auto","tools":[{"id":"eea39d89-6da1-4401-a6bb-41d0ad5fd1a9","type":"PanTool"},{"id":"dbdcf43e-f6cd-4999-8664-7d4bbeb28b1b","type":"WheelZoomTool"},{"id":"5e93a11e-972b-4ea4-9ebd-e030a0a92bf5","type":"BoxZoomTool"},{"id":"7b78cfe2-aa29-4245-98c3-b8678943be2c","type":"SaveTool"},{"id":"d5662033-1332-448f-8078-b1b5fc6ebedd","type":"ResetTool"},{"id":"3bcc793e-9b7f-42f7-b939-437b29982b6f","type":"HelpTool"}]},"id":"e29112ae-02d0-4dc6-9788-c3bcd084c560","type":"Toolbar"},{"attributes":{},"id":"ee7e7d93-1a3d-4273-ad05-0dae9c2e2608","type":"BasicTicker"},{"attributes":{"data_source":{"id":"7fedd7ce-eb1b-4533-8e35-492e9f4f6723","type":"ColumnDataSource"},"glyph":{"id":"5c2d97f3-520b-4a40-b4a2-41bde9d2dbc6","type":"Line"},"hover_glyph":null,"muted_glyph":null,"nonselection_glyph":{"id":"762d72ea-6726-4767-aed8-9a5abfbd3abf","type":"Line"},"selection_glyph":null,"view":{"id":"d9fbc277-e9f7-409c-a9b7-8362fed1fe82","type":"CDSView"}},"id":"d495f273-35fd-4f1d-a7c7-44cdc6e2043b","type":"GlyphRenderer"},{"attributes":{},"id":"fdf26c70-7fce-4158-800f-62ef31b890ac","type":"ResetTool"},{"attributes":{"bottom_units":"screen","fill_alpha":{"value":0.5},"fill_color":{"value":"lightgrey"},"left_units":"screen","level":"overlay","line_alpha":{"value":1.0},"line_color":{"value":"black"},"line_dash":[4,4],"line_width":{"value":2},"plot":null,"render_mode":"css","right_units":"screen","top_units":"screen"},"id":"56b62953-67f6-43e5-8665-1ae0b33a3587","type":"BoxAnnotation"},{"attributes":{},"id":"f2bb603d-d041-46dc-9149-5d20c78da06e","type":"PanTool"},{"attributes":{"callback":null,"data":{"x":[1,2,3,4,5],"y":[6,7,8,9,10]},"selected":{"id":"7453ce84-2208-4e58-9d06-ddd3ca1708f6","type":"Selection"},"selection_policy":{"id":"601e5c38-1a36-447b-83d5-64411a4833e8","type":"UnionRenderers"}},"id":"21c90c7e-c156-400b-ba70-8b67b31b460c","type":"ColumnDataSource"},{"attributes":{},"id":"7c17ff42-bbc4-4e59-a0b3-eebe55024f05","type":"BasicTicker"},{"attributes":{"active_drag":"auto","active_inspect":"auto","active_multi":null,"active_scroll":"auto","active_tap":"auto","tools":[{"id":"f2bb603d-d041-46dc-9149-5d20c78da06e","type":"PanTool"},{"id":"ad0a537b-c0d3-4808-846f-be215dbd4631","type":"WheelZoomTool"},{"id":"2ebb0a9b-1f3e-4e0e-b54c-dab483d9ad1d","type":"BoxZoomTool"},{"id":"c17f31c6-ea53-4bda-b425-65e087f9b126","type":"SaveTool"},{"id":"fdf26c70-7fce-4158-800f-62ef31b890ac","type":"ResetTool"},{"id":"949b3238-ac22-4ad2-b652-af77d2e455ad","type":"HelpTool"}]},"id":"096653f5-de71-4386-8bb7-0712ad1765ca","type":"Toolbar"},{"attributes":{},"id":"18ee1741-c202-4f4b-b52e-c2cc490b8f6f","type":"BasicTicker"},{"attributes":{"formatter":{"id":"83cded7e-dad6-4fc7-b0f2-761cc4012436","type":"BasicTickFormatter"},"plot":{"id":"4da3e749-cdb4-48ed-8dc6-b78818d8f587","subtype":"Figure","type":"Plot"},"ticker":{"id":"7c17ff42-bbc4-4e59-a0b3-eebe55024f05","type":"BasicTicker"}},"id":"f5b7139e-5848-412b-9e0b-9c60547d3a47","type":"LinearAxis"},{"attributes":{"data_source":{"id":"21c90c7e-c156-400b-ba70-8b67b31b460c","type":"ColumnDataSource"},"glyph":{"id":"58e9f325-f8d1-44cb-9e83-f757a0bd329a","type":"Line"},"hover_glyph":null,"muted_glyph":null,"nonselection_glyph":{"id":"b6c181de-6d18-433b-8bbd-b14169b56eb5","type":"Line"},"selection_glyph":null,"view":{"id":"64bb6a0d-f877-4657-9ade-525ec88605a9","type":"CDSView"}},"id":"f17257ba-4f75-42c7-893b-a4cf0036740b","type":"GlyphRenderer"},{"attributes":{"dimension":1,"plot":{"id":"4da3e749-cdb4-48ed-8dc6-b78818d8f587","subtype":"Figure","type":"Plot"},"ticker":{"id":"7c17ff42-bbc4-4e59-a0b3-eebe55024f05","type":"BasicTicker"}},"id":"448ae753-190a-47b3-b48c-48d42ad5c905","type":"Grid"},{"attributes":{"callback":null},"id":"320a3e54-e61a-45c3-b12e-64c5570e1c82","type":"DataRange1d"},{"attributes":{"plot":{"id":"4da3e749-cdb4-48ed-8dc6-b78818d8f587","subtype":"Figure","type":"Plot"},"ticker":{"id":"ee7e7d93-1a3d-4273-ad05-0dae9c2e2608","type":"BasicTicker"}},"id":"408bec16-a4cc-48b8-a8e8-9753f9815ed4","type":"Grid"},{"attributes":{},"id":"86e986bf-1069-41b3-b75c-db7e68d1b161","type":"LinearScale"},{"attributes":{},"id":"9e7303e6-a33a-4cfd-8a41-23f8c9b4fe8f","type":"LinearScale"},{"attributes":{},"id":"4d5fd9c6-8637-4d02-b775-2411c95a5d06","type":"LinearScale"},{"attributes":{"formatter":{"id":"f2264866-9fec-45b0-b242-5111fcc1c4fb","type":"BasicTickFormatter"},"plot":{"id":"2da75283-6f20-4600-884a-98e59b066e28","subtype":"Figure","type":"Plot"},"ticker":{"id":"69a59dc3-f814-4f87-a39d-e79d8e0c624c","type":"BasicTicker"}},"id":"264bb8f9-c4f8-4f19-959e-25e2f7c2a656","type":"LinearAxis"},{"attributes":{},"id":"3bcc793e-9b7f-42f7-b939-437b29982b6f","type":"HelpTool"},{"attributes":{"dimension":1,"plot":{"id":"2da75283-6f20-4600-884a-98e59b066e28","subtype":"Figure","type":"Plot"},"ticker":{"id":"69a59dc3-f814-4f87-a39d-e79d8e0c624c","type":"BasicTicker"}},"id":"f496d5a9-0ee6-460b-9016-3fa5c19a56a7","type":"Grid"},{"attributes":{},"id":"1b240c0f-07b2-4113-a8a8-a4efc1583fdd","type":"BasicTickFormatter"},{"attributes":{},"id":"69a59dc3-f814-4f87-a39d-e79d8e0c624c","type":"BasicTicker"},{"attributes":{"source":{"id":"7fedd7ce-eb1b-4533-8e35-492e9f4f6723","type":"ColumnDataSource"}},"id":"d9fbc277-e9f7-409c-a9b7-8362fed1fe82","type":"CDSView"},{"attributes":{"callback":null},"id":"98a9bfe3-e787-4432-af9d-0f3f9f086166","type":"DataRange1d"},{"attributes":{},"id":"7453ce84-2208-4e58-9d06-ddd3ca1708f6","type":"Selection"},{"attributes":{"plot":{"id":"2da75283-6f20-4600-884a-98e59b066e28","subtype":"Figure","type":"Plot"},"ticker":{"id":"18ee1741-c202-4f4b-b52e-c2cc490b8f6f","type":"BasicTicker"}},"id":"937c1124-b157-4eca-a0b3-75f6ef2dda90","type":"Grid"},{"attributes":{"callback":null},"id":"95e74f2e-df09-4945-a76e-c185eea3d4df","type":"DataRange1d"},{"attributes":{"formatter":{"id":"2030a3a4-7747-427a-a1dd-ffc3901ee9be","type":"BasicTickFormatter"},"plot":{"id":"4da3e749-cdb4-48ed-8dc6-b78818d8f587","subtype":"Figure","type":"Plot"},"ticker":{"id":"ee7e7d93-1a3d-4273-ad05-0dae9c2e2608","type":"BasicTicker"}},"id":"90583a87-4ad1-402c-aa3c-1a3c661e7406","type":"LinearAxis"},{"attributes":{"source":{"id":"7f04e4d5-b03b-4ebb-a89d-f65cbb91b729","type":"ColumnDataSource"}},"id":"58980905-7efb-4a11-8de9-9b10e9b1d1c8","type":"CDSView"},{"attributes":{"callback":null,"data":{"x":[3,7.5,10],"y":[3,6,9]},"selected":{"id":"668b3eb0-b6de-4fc7-ae7b-d1a7ce923009","type":"Selection"},"selection_policy":{"id":"4dc9ce99-d94b-4fbd-9ed2-ef8bb292be8b","type":"UnionRenderers"}},"id":"7f04e4d5-b03b-4ebb-a89d-f65cbb91b729","type":"ColumnDataSource"},{"attributes":{"line_alpha":0.1,"line_color":"#1f77b4","x":{"field":"x"},"y":{"field":"y"}},"id":"762d72ea-6726-4767-aed8-9a5abfbd3abf","type":"Line"},{"attributes":{},"id":"5ec88388-4913-436f-b8a6-cfd6d391154c","type":"BasicTickFormatter"},{"attributes":{},"id":"eea39d89-6da1-4401-a6bb-41d0ad5fd1a9","type":"PanTool"},{"attributes":{"callback":null},"id":"d9d21cdf-f19b-4f95-98ba-ef43d9aec5a7","type":"DataRange1d"},{"attributes":{},"id":"ad0a537b-c0d3-4808-846f-be215dbd4631","type":"WheelZoomTool"},{"attributes":{"formatter":{"id":"1b240c0f-07b2-4113-a8a8-a4efc1583fdd","type":"BasicTickFormatter"},"plot":{"id":"2da75283-6f20-4600-884a-98e59b066e28","subtype":"Figure","type":"Plot"},"ticker":{"id":"18ee1741-c202-4f4b-b52e-c2cc490b8f6f","type":"BasicTicker"}},"id":"8977dc31-58c8-4dda-95bc-70199558a319","type":"LinearAxis"},{"attributes":{},"id":"2030a3a4-7747-427a-a1dd-ffc3901ee9be","type":"BasicTickFormatter"},{"attributes":{},"id":"541dc82f-bd18-4993-adff-060c1167d6ab","type":"Selection"},{"attributes":{},"id":"4dc9ce99-d94b-4fbd-9ed2-ef8bb292be8b","type":"UnionRenderers"},{"attributes":{},"id":"83cded7e-dad6-4fc7-b0f2-761cc4012436","type":"BasicTickFormatter"},{"attributes":{"bottom_units":"screen","fill_alpha":{"value":0.5},"fill_color":{"value":"lightgrey"},"left_units":"screen","level":"overlay","line_alpha":{"value":1.0},"line_color":{"value":"black"},"line_dash":[4,4],"line_width":{"value":2},"plot":null,"render_mode":"css","right_units":"screen","top_units":"screen"},"id":"647df24a-7a53-48f7-850b-e99faaf7e12c","type":"BoxAnnotation"},{"attributes":{},"id":"949b3238-ac22-4ad2-b652-af77d2e455ad","type":"HelpTool"},{"attributes":{"formatter":{"id":"5ec88388-4913-436f-b8a6-cfd6d391154c","type":"BasicTickFormatter"},"plot":{"id":"635f8152-f2d6-4568-ae68-2973f310eaf8","subtype":"Figure","type":"Plot"},"ticker":{"id":"164ee759-2971-4dd9-ac18-35cdb02fca0e","type":"BasicTicker"}},"id":"f1e22f73-d0fc-46b4-a3b4-b264cf417d4a","type":"LinearAxis"},{"attributes":{"callback":null},"id":"0eb66654-fd86-43a2-8b94-2f345c420dec","type":"DataRange1d"},{"attributes":{},"id":"dbdcf43e-f6cd-4999-8664-7d4bbeb28b1b","type":"WheelZoomTool"},{"attributes":{"callback":null},"id":"66ecc1d0-d899-41cd-b791-13176cd24a81","type":"DataRange1d"},{"attributes":{},"id":"26a46564-9ff5-4fdb-987a-a2119540680b","type":"LinearScale"},{"attributes":{"formatter":{"id":"e87b8867-6df4-4f58-a378-25f653b25bf6","type":"BasicTickFormatter"},"plot":{"id":"635f8152-f2d6-4568-ae68-2973f310eaf8","subtype":"Figure","type":"Plot"},"ticker":{"id":"cfd25d7d-feea-4647-911d-6a5605dc3d71","type":"BasicTicker"}},"id":"474d496d-aa15-4fe3-b163-0a629270845f","type":"LinearAxis"},{"attributes":{"below":[{"id":"90583a87-4ad1-402c-aa3c-1a3c661e7406","type":"LinearAxis"}],"left":[{"id":"f5b7139e-5848-412b-9e0b-9c60547d3a47","type":"LinearAxis"}],"renderers":[{"id":"90583a87-4ad1-402c-aa3c-1a3c661e7406","type":"LinearAxis"},{"id":"408bec16-a4cc-48b8-a8e8-9753f9815ed4","type":"Grid"},{"id":"f5b7139e-5848-412b-9e0b-9c60547d3a47","type":"LinearAxis"},{"id":"448ae753-190a-47b3-b48c-48d42ad5c905","type":"Grid"},{"id":"647df24a-7a53-48f7-850b-e99faaf7e12c","type":"BoxAnnotation"},{"id":"d495f273-35fd-4f1d-a7c7-44cdc6e2043b","type":"GlyphRenderer"}],"title":{"id":"d4c3a0d9-1a75-4bf7-a107-1d30bf785c76","type":"Title"},"toolbar":{"id":"096653f5-de71-4386-8bb7-0712ad1765ca","type":"Toolbar"},"x_range":{"id":"95e74f2e-df09-4945-a76e-c185eea3d4df","type":"DataRange1d"},"x_scale":{"id":"c561783a-f07e-44c4-8bce-04e3a3363ae6","type":"LinearScale"},"y_range":{"id":"0eb66654-fd86-43a2-8b94-2f345c420dec","type":"DataRange1d"},"y_scale":{"id":"4d5fd9c6-8637-4d02-b775-2411c95a5d06","type":"LinearScale"}},"id":"4da3e749-cdb4-48ed-8dc6-b78818d8f587","subtype":"Figure","type":"Plot"},{"attributes":{},"id":"f95a9d96-e1ac-4ce5-bc22-36cf2f38f282","type":"LinearScale"},{"attributes":{"line_color":"#1f77b4","x":{"field":"x"},"y":{"field":"y"}},"id":"5c2d97f3-520b-4a40-b4a2-41bde9d2dbc6","type":"Line"},{"attributes":{"active_drag":"auto","active_inspect":"auto","active_multi":null,"active_scroll":"auto","active_tap":"auto","tools":[{"id":"568ebe47-1b17-4fc7-8859-72a1e4b19c03","type":"PanTool"},{"id":"e1d4052b-2921-4d77-ad94-6918560aa1ba","type":"WheelZoomTool"},{"id":"0854e626-a869-4df9-8767-e630ecd58a96","type":"BoxZoomTool"},{"id":"110fc368-ca75-4219-8f15-890fcdb2f36b","type":"SaveTool"},{"id":"885ac673-f730-49e8-813f-64fd64eaf473","type":"ResetTool"},{"id":"f80496c0-9c80-4a80-8f2f-da85474351ca","type":"HelpTool"}]},"id":"f941560f-8e6b-451c-9eb8-adefc4eb40ab","type":"Toolbar"},{"attributes":{"below":[{"id":"f1e22f73-d0fc-46b4-a3b4-b264cf417d4a","type":"LinearAxis"}],"left":[{"id":"474d496d-aa15-4fe3-b163-0a629270845f","type":"LinearAxis"}],"renderers":[{"id":"f1e22f73-d0fc-46b4-a3b4-b264cf417d4a","type":"LinearAxis"},{"id":"76ad232d-7081-49f8-aed9-647e4230aca4","type":"Grid"},{"id":"474d496d-aa15-4fe3-b163-0a629270845f","type":"LinearAxis"},{"id":"c3bc6c16-6356-43da-9153-d0f6463dc876","type":"Grid"},{"id":"9f88dd88-dbad-4b5b-ae2d-b1d2d8c36a15","type":"BoxAnnotation"},{"id":"e8a9236a-3159-4555-ab32-5a71f98315fe","type":"GlyphRenderer"}],"title":{"id":"398834ce-a8d9-46e0-923e-ab71eb6e8aa8","type":"Title"},"toolbar":{"id":"f941560f-8e6b-451c-9eb8-adefc4eb40ab","type":"Toolbar"},"x_range":{"id":"320a3e54-e61a-45c3-b12e-64c5570e1c82","type":"DataRange1d"},"x_scale":{"id":"26a46564-9ff5-4fdb-987a-a2119540680b","type":"LinearScale"},"y_range":{"id":"66ecc1d0-d899-41cd-b791-13176cd24a81","type":"DataRange1d"},"y_scale":{"id":"f95a9d96-e1ac-4ce5-bc22-36cf2f38f282","type":"LinearScale"}},"id":"635f8152-f2d6-4568-ae68-2973f310eaf8","subtype":"Figure","type":"Plot"},{"attributes":{"plot":{"id":"635f8152-f2d6-4568-ae68-2973f310eaf8","subtype":"Figure","type":"Plot"},"ticker":{"id":"164ee759-2971-4dd9-ac18-35cdb02fca0e","type":"BasicTicker"}},"id":"76ad232d-7081-49f8-aed9-647e4230aca4","type":"Grid"},{"attributes":{},"id":"164ee759-2971-4dd9-ac18-35cdb02fca0e","type":"BasicTicker"},{"attributes":{"callback":null,"data":{"x":[1,2,3,4,5],"y":[6,7,8,9,10]},"selected":{"id":"541dc82f-bd18-4993-adff-060c1167d6ab","type":"Selection"},"selection_policy":{"id":"ad391a37-ff57-4e0e-a32f-1fc91db098fc","type":"UnionRenderers"}},"id":"7fedd7ce-eb1b-4533-8e35-492e9f4f6723","type":"ColumnDataSource"},{"attributes":{"dimension":1,"plot":{"id":"635f8152-f2d6-4568-ae68-2973f310eaf8","subtype":"Figure","type":"Plot"},"ticker":{"id":"cfd25d7d-feea-4647-911d-6a5605dc3d71","type":"BasicTicker"}},"id":"c3bc6c16-6356-43da-9153-d0f6463dc876","type":"Grid"},{"attributes":{},"id":"cfd25d7d-feea-4647-911d-6a5605dc3d71","type":"BasicTicker"},{"attributes":{},"id":"c561783a-f07e-44c4-8bce-04e3a3363ae6","type":"LinearScale"},{"attributes":{},"id":"ad391a37-ff57-4e0e-a32f-1fc91db098fc","type":"UnionRenderers"},{"attributes":{"plot":null,"text":""},"id":"398834ce-a8d9-46e0-923e-ab71eb6e8aa8","type":"Title"},{"attributes":{},"id":"568ebe47-1b17-4fc7-8859-72a1e4b19c03","type":"PanTool"},{"attributes":{},"id":"e1d4052b-2921-4d77-ad94-6918560aa1ba","type":"WheelZoomTool"},{"attributes":{"overlay":{"id":"9f88dd88-dbad-4b5b-ae2d-b1d2d8c36a15","type":"BoxAnnotation"}},"id":"0854e626-a869-4df9-8767-e630ecd58a96","type":"BoxZoomTool"},{"attributes":{},"id":"110fc368-ca75-4219-8f15-890fcdb2f36b","type":"SaveTool"},{"attributes":{},"id":"885ac673-f730-49e8-813f-64fd64eaf473","type":"ResetTool"},{"attributes":{},"id":"f80496c0-9c80-4a80-8f2f-da85474351ca","type":"HelpTool"},{"attributes":{"bottom_units":"screen","fill_alpha":{"value":0.5},"fill_color":{"value":"lightgrey"},"left_units":"screen","level":"overlay","line_alpha":{"value":1.0},"line_color":{"value":"black"},"line_dash":[4,4],"line_width":{"value":2},"plot":null,"render_mode":"css","right_units":"screen","top_units":"screen"},"id":"9f88dd88-dbad-4b5b-ae2d-b1d2d8c36a15","type":"BoxAnnotation"},{"attributes":{"fill_alpha":{"value":0.1},"fill_color":{"value":"#1f77b4"},"line_alpha":{"value":0.1},"line_color":{"value":"#1f77b4"},"x":{"field":"x"},"y":{"field":"y"}},"id":"8f473bf9-6ee0-4c0f-b549-b2f0b00fa17f","type":"Triangle"},{"attributes":{"line_color":"#1f77b4","x":{"field":"x"},"y":{"field":"y"}},"id":"58e9f325-f8d1-44cb-9e83-f757a0bd329a","type":"Line"},{"attributes":{"line_alpha":0.1,"line_color":"#1f77b4","x":{"field":"x"},"y":{"field":"y"}},"id":"b6c181de-6d18-433b-8bbd-b14169b56eb5","type":"Line"},{"attributes":{},"id":"668b3eb0-b6de-4fc7-ae7b-d1a7ce923009","type":"Selection"},{"attributes":{"plot":null,"text":""},"id":"d4c3a0d9-1a75-4bf7-a107-1d30bf785c76","type":"Title"},{"attributes":{},"id":"e87b8867-6df4-4f58-a378-25f653b25bf6","type":"BasicTickFormatter"},{"attributes":{},"id":"7b78cfe2-aa29-4245-98c3-b8678943be2c","type":"SaveTool"},{"attributes":{},"id":"601e5c38-1a36-447b-83d5-64411a4833e8","type":"UnionRenderers"},{"attributes":{"data_source":{"id":"7f04e4d5-b03b-4ebb-a89d-f65cbb91b729","type":"ColumnDataSource"},"glyph":{"id":"cda92757-3dcd-42cb-95b9-392e57684258","type":"Triangle"},"hover_glyph":null,"muted_glyph":null,"nonselection_glyph":{"id":"8f473bf9-6ee0-4c0f-b549-b2f0b00fa17f","type":"Triangle"},"selection_glyph":null,"view":{"id":"58980905-7efb-4a11-8de9-9b10e9b1d1c8","type":"CDSView"}},"id":"e8a9236a-3159-4555-ab32-5a71f98315fe","type":"GlyphRenderer"},{"attributes":{"below":[{"id":"8977dc31-58c8-4dda-95bc-70199558a319","type":"LinearAxis"}],"left":[{"id":"264bb8f9-c4f8-4f19-959e-25e2f7c2a656","type":"LinearAxis"}],"renderers":[{"id":"8977dc31-58c8-4dda-95bc-70199558a319","type":"LinearAxis"},{"id":"937c1124-b157-4eca-a0b3-75f6ef2dda90","type":"Grid"},{"id":"264bb8f9-c4f8-4f19-959e-25e2f7c2a656","type":"LinearAxis"},{"id":"f496d5a9-0ee6-460b-9016-3fa5c19a56a7","type":"Grid"},{"id":"56b62953-67f6-43e5-8665-1ae0b33a3587","type":"BoxAnnotation"},{"id":"f17257ba-4f75-42c7-893b-a4cf0036740b","type":"GlyphRenderer"}],"title":{"id":"af901232-8aa2-488c-932c-c8e5dda2750d","type":"Title"},"toolbar":{"id":"e29112ae-02d0-4dc6-9788-c3bcd084c560","type":"Toolbar"},"x_range":{"id":"98a9bfe3-e787-4432-af9d-0f3f9f086166","type":"DataRange1d"},"x_scale":{"id":"86e986bf-1069-41b3-b75c-db7e68d1b161","type":"LinearScale"},"y_range":{"id":"d9d21cdf-f19b-4f95-98ba-ef43d9aec5a7","type":"DataRange1d"},"y_scale":{"id":"9e7303e6-a33a-4cfd-8a41-23f8c9b4fe8f","type":"LinearScale"}},"id":"2da75283-6f20-4600-884a-98e59b066e28","subtype":"Figure","type":"Plot"},{"attributes":{"overlay":{"id":"56b62953-67f6-43e5-8665-1ae0b33a3587","type":"BoxAnnotation"}},"id":"5e93a11e-972b-4ea4-9ebd-e030a0a92bf5","type":"BoxZoomTool"},{"attributes":{"plot":null,"text":""},"id":"af901232-8aa2-488c-932c-c8e5dda2750d","type":"Title"},{"attributes":{"fill_color":{"value":"#1f77b4"},"line_color":{"value":"#1f77b4"},"x":{"field":"x"},"y":{"field":"y"}},"id":"cda92757-3dcd-42cb-95b9-392e57684258","type":"Triangle"},{"attributes":{"source":{"id":"21c90c7e-c156-400b-ba70-8b67b31b460c","type":"ColumnDataSource"}},"id":"64bb6a0d-f877-4657-9ade-525ec88605a9","type":"CDSView"},{"attributes":{},"id":"f2264866-9fec-45b0-b242-5111fcc1c4fb","type":"BasicTickFormatter"}],"root_ids":["635f8152-f2d6-4568-ae68-2973f310eaf8","2da75283-6f20-4600-884a-98e59b066e28","4da3e749-cdb4-48ed-8dc6-b78818d8f587"]},"title":"Bokeh Application","version":"0.13.0"}}
</script>
<script type="text/javascript">
(function() {
var fn = function() {
Bokeh.safely(function() {
(function(root) {
function embed_document(root) {
var docs_json = document.getElementById('41bd10a1-5a61-4504-80f1-8c56f40e644b').textContent;
var render_items = [{"docid":"c99a857f-320f-48ba-8576-3ef2bd47c6ce","roots":{"4da3e749-cdb4-48ed-8dc6-b78818d8f587":"d48bbd43-55c8-4727-befa-468754bdb0b5"}}];
root.Bokeh.embed.embed_items(docs_json, render_items);
}
if (root.Bokeh !== undefined) {
embed_document(root);
} else {
var attempts = 0;
var timer = setInterval(function(root) {
if (root.Bokeh !== undefined) {
embed_document(root);
clearInterval(timer);
}
attempts++;
if (attempts > 100) {
console.log("Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing")
clearInterval(timer);
}
}, 10, root)
}
})(window);
});
};
if (document.readyState != "loading") fn();
else document.addEventListener("DOMContentLoaded", fn);
})();
</script>
</body>
</html>
Yes that will happen but is easy to resolve :
right click the (output html file) in working folder ---> hover over open with----> choose default program---> click on always open with (google chrome)
Now the next time you run your code plot will open up in chrome instead of .html file in notepad

snap svg try to rotate an object with center point but not work

I learn to use snap svg this library and want to rotate an object. However, I get a weird rotate effect and can't find what the problem is.
the following is the code snippet and you can have it a look.
var s = Snap("#container");
//lets draw 2 rects at position 100,100 and then reposition them
var r = s.rect(100,100,100,100).attr({fill: 'red' });
var g = s.group(r);
var bbox = g.getBBox();
s.text(20, 20, bbox.cx);
s.text(20, 40, bbox.cy);
g.animate({ transform: 'r180,'+ bbox.cx + ',' + bbox.cy }, 1000, mina.bounce );
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/snap.svg/0.5.1/snap.svg-min.js"></script>
</head>
<body>
<div style="width: 335px; height: 600px;">
<svg width='100%' height='100%' id='container'></svg>
</div>
</body>
</html>
Hope somebody can tell me :)
I think there's a bug in Snap 0.5/0.5.1 see here.
First thing I would do, is try Snap 0.4.1 eg here and see if that fixes it. I think it's fixed for 0.5.2, but not sure if that's available yet.
If it doesn't fix it, update the question to mention you have also tried 0.4.1.

topojson.feature with topojson v2

I've been following the "let's make a map" tutorial https://bost.ocks.org/mike/map/, however in the middle of the tutorial, drawing the paths failed with errors about topojson.feature() is not a function.
script.js:14 Uncaught TypeError: topojson.feature is not a function(…)
(anonymous function) # script.js:14
(anonymous function) # d3.min.js:6
call # d3.min.js:6
e # d3.min.js:6
script.js:
var width = 960,
height = 1160;
var svg = d3.select("body").append("svg")
.attr("width", width)
.attr("height", height);
d3.json("js/uk.json", function(error, uk) {
if (error) return console.error(error);
console.log(uk);
svg.append("path")
.datum(topojson.feature(uk, uk.objects.subunits))
.attr("d", d3.geo.path().projection(d3.geo.mercator()));
});
HTML included scripts:
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.4.0/d3.min.js"></script>
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="utf-8" />
<title>Map test</title>
<link href="css/main.css" rel="stylesheet" type="text/css" />
</head>
<body>
<script src='js/jquery.js'></script>
<script src='js/d3.min.js' charset="utf-8"></script>
<script src='js/topojson.js'></script>
<script src="js/script.js" type="text/javascript"></script>
</body>
</html>
Originally I've suspected the issue to be with the topojson file I've converted Pathfile-GeoJSON-TopoJSON, I've names it uk.js for testing purposes while following the tutorial.
Another hint as mentioned in the reply here:
https://github.com/topojson/topojson/issues/236
However after changing the issue remained the same, and confirmed after substituting uk.json I've creted myself with:
https://bost.ocks.org/mike/map/uk.json
You are missing the topojson client files, which have been split off from the base topojson code in v2. If you include the following script in your code, it should work:
<script src="https://unpkg.com/topojson-client#2"></script>

Resources