Based on http://bl.ocks.org/mbostock/899711 which uses D3 to draw elements into a google maps overlay layer, but doesn't use d3.geo machinery to draw map geometry. This gist illustrates how to align a D3 mercator projection with google maps so we can do standard d3 mapping stuff on top of the google API.
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
//making bubble chart. circle= data of size. | |
symbols(teamvelocity$TotalPoints, teamvelocity$TotalDevs, circles=teamvelocity$Team, inches=0.35, fg="#00FFFF", ylab="Team Members", xlab="velocity", bg="#CCCCCC") | |
//show stacked two charts at the same time. layout() is the frame. | |
layout(matrix(1:2, nrow = 2)) | |
par(mar = par("mar") * c(0.8,1,1,1)) | |
boxplot(m$mortality, ylim=xr, horizontal = TRUE, xlab="mortality") | |
hist(m$mortality, ylit=xr) | |
//以下に永続的に値を適用する=par |
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
//simplest making pointplot | |
ggplot(m,ase(x=ocean,y=mortality)) + geom_point() | |
//divide into color on barchart = geom_histogram(aes(fill=...)) | |
g + geom_histogram(alpha=0.5, aes(fill=ocean)) |
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
// chack if I am on master branch, and hold commited things ahead of pushing. | |
git status | |
//clone URL | |
git@github.com:wantanmen/Electrophoresis.D3.git | |
//add | |
git add <file> | |
//commit |
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
#1scrapy基本 | |
--items.py でアイテムフィールドを設定する。今回はタイトルとリンク。 | |
from scrapy.item import Item, Field | |
class CraigslistSampleItem(Item): | |
# define the fields for your item here like: | |
# name = Field() | |
title = Field() | |
link = Field() |
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
#1 日本語のcsvファイルを読み込むには、unicodecsvを使う。 | |
#これはcsvを読み込むときにutf-8化した後、出力でunicode化してくれるもの。 | |
#目的のcsvをメモ等などで、utf-8で保存した後、以下で読み込む。 | |
import unicodecsv | |
f = open("utf30.csv","rb") | |
r = unicodecsv.reader(f, encoding='utf-8') |
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
#1Get coorinate using pygeocoder and googlemap API throuth place data in Japaneese. | |
#pygeopicker.py | |
# -*- coding: utf-8 -*- | |
from pygeocoder import Geocoder | |
import unicodecsv | |
def pick(query): | |
print "start" |
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
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<body> | |
<script src="http://d3js.org/d3.v2.min.js?2.10.0"></script> | |
<script> | |
var width = 960, | |
height = 700; | |
var svg = d3.select("body").append("svg") |
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
#1 | |
#2 map_change coordinates into x,y by projection([lon,lat]) | |
var coordinates = projection([mylon, mylat]); | |
map.append('svg:circle') | |
.attr('cx', coordinates[0]) | |
.attr('cy', coordinates[1]) | |
.attr('r', 5); |
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
#1 d3.csv to [{x:~},{y:~}] | |
var makeData = function(d,country){ | |
var list = []; | |
d.forEach(function(datum){ | |
var obj = {}; | |
obj["x"]= parseInt(datum.id); | |
obj["y"] = parseInt(datum[country]); |
OlderNewer