Skip to content

Instantly share code, notes, and snippets.

@asuozzo
Last active November 23, 2015 16:49
Show Gist options
  • Save asuozzo/565ff792558a4c4cf4f2 to your computer and use it in GitHub Desktop.
Save asuozzo/565ff792558a4c4cf4f2 to your computer and use it in GitHub Desktop.
Books per Capita at Vermont Public Libraries
<html>
<head>
<meta charset="utf-8">
<meta name="description" content="$1">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Books per Capita at Vermont Libraries</title>
<script type="text/javascript" src="http://d3js.org/d3.v3.js"></script>
<style type="text/css">
body {
background-image: url("https://farm1.staticflickr.com/764/22468805072_941b892fde_z_d.jpg");
}
p {
font-family: "Times New Roman", Times, serif;
font-size: 16px;
}
#container {
width: 750px;
background-color: white;
opacity:.96;
margin-right: auto;
margin-left: auto;
margin-top: 50px;
padding: 30px;
box-shadow: 3px 3px 4px 4px white;
}
g.bar {
cursor:pointer;
}
g.bar text {
font-size:11px;
font-weight:bold;
font-family: sans-serif;
text-anchor:end;
opacity:0;
}
g.bar:hover rect {
fill:#FFC50C;
}
g.bar:hover text {
opacity:1;
}
.axis path,
.axis line,
.x.axis text {
opacity:0;
}
.axis text {
font-family: sans-serif;
font-size: 12px;
}
</style>
</head>
<body>
<div id="container">
<h2>Library Books Per Capita in Vermont Towns</h2>
<p>How many books per person did each Vermont library own in 2012?</p>
<div id="interactive">
</div>
<p> Based on data Vermont libraries reported to the state for the 2011-2012 fiscal year. Book totals combine juvenile and adult collections. Libraries with no data or that did not report book holdings were removed from the dataset. Data source: <a href="http://data.vermont.gov">data.vermont.gov</a>. Photo source: <a href="https://www.flickr.com/photos/opengridscheduler/22468805072/in/photolist-AeuuWU-ae2fN8-iiYSpn-6QgCe7-3VtKTW-EHFvk-7jsaxM-bd1iXc-zdcoo-4DpjJ4-2CDj2G-BXkF-crxUku-Ci7ob-5N91bG-bBWVfu-57AiN1-7jw3GQ-nJdzc5-4vi5DU-6CoZoQ-5jZgXa-9e1nhe-81t2H-r3zodL-6goydB-eaGPCC-oXT4dX-7rZUW-SvvYy-dyVaGd-7rXZJ-6iUdMZ-9F1kV5-Bf1yg-9L4DC-yEh31-6goynK-51mJzS-bpCg9W-bCxchi-6gsKZ1-MYMa-8o2W6L-4vnApi-bssAcn-845fnR-4E2P4W-6WFyvy-bGXBR8">Flickr Creative Commons</a></p>
</div>
<script type="text/javascript">
var w = 700;
var h = 2500;
var padding = [20,10,50,125];
var widthScale = d3.scale.linear()
.range([0, w-padding[1] - padding[3] ]);
var heightScale = d3.scale.ordinal()
.rangeRoundBands([padding[0], h-padding[2] ], 0.15);
var xAxis = d3.svg.axis()
.scale(widthScale)
.orient("bottom");
var yAxis = d3.svg.axis()
.scale(heightScale)
.orient("left");
var svg = d3.select("#interactive")
.append("svg")
.attr("width", w)
.attr("height", h);
d3.csv("vtpublib2012.csv", function(data) {
data.sort(function(a, b){
return d3.descending(+a.booksPerCapita, +b.booksPerCapita);
});
widthScale.domain([0, d3.max(data, function(d){
return +d.booksPerCapita;
console.log(d.booksPerCapita);
}) ]);
heightScale.domain(data.map(function(d){
return d.Town;
}))
var groups = svg.selectAll("g")
.data(data)
.enter()
.append("g")
.attr("class", "bar");
var rects = groups.append("rect")
.attr("x", padding[3])
.attr("y", function(d){
return heightScale(d.Town);
})
.attr("width", 0)
.attr("height", heightScale.rangeBand())
.attr("fill", "#2C1CFF");
groups.append("text")
.attr("x", function(d){
return padding[3] + widthScale(d.booksPerCapita)-3;
})
.attr("y", function(d){
return heightScale(d.Town)+10;
})
.text(function(d){
return d.booksPerCapita;
});
rects.transition()
.delay(function(d, i){
return i*5;
})
.duration(1000)
.attr("width", function(d){
return widthScale(d.booksPerCapita);
});
svg.append("g")
.attr("class", "x axis")
.attr("transform", "translate(" + padding[3] + "," + (h - padding[2]) + ")")
.call(xAxis);
svg.append("g")
.attr("class", "y axis")
.attr("transform", "translate(" + padding[3] + ",0)")
.call(yAxis);
})
</script>
</body>
</html>
Town Library Population TotalIncome TotalExpense Books booksPerCapita Borrowers Visits
Alburgh Alburg Public 1870 $59,678.00 $61,904.00 12417 6.6 1998 19396
Arlington Martha Canfield Memorial 3824 $72,714.00 $97,572.00 28261 7.4 1540 18460
Bakersfield H. F. Brigham Free 1426 $32,220.00 $29,457.00 10368 7.3 1227 2704
Barnard Charles B. Danforth 1129 $8,976.00 $5,977.00 6900 6.1 181 208
Barnet Barnet Public 1828 $22,352.00 $21,384.00 7883 4.3 613 4004
Barre Aldrich Public 16977 $308,540.00 $363,968.00 48700 2.9 8865 156000
Barton Barton Public 1544 $33,082.00 $48,431.00 14600 9.5 1155 14820
Barton/Orleans Jones Memorial 2404 $63,237.00 $65,998.00 27003 11.2 4854 8476
Bennington Bennington Free 18484 $439,223.00 $466,255.00 63216 3.4 8376 77948
North Bennington J. G. McCullough Free 3036 $44,613.00 $99,832.00 23981 7.9 3623 8060
Bradford Bradford Public 2785 $64,155.00 $64,540.00 21510 7.7 800 15340
Brandon Brandon Free Public 5490 $157,711.00 $166,993.00 20411 3.7 N/A 73060
Brattleboro Brooks Memorial 12031 $801,555.00 $777,203.00 73184 6.1 7473 153036
Brighton Island Pond Public 990 $57,143.00 $61,330.00 11200 11.3 800 13000
Bristol Lawrence Memorial 3898 $130,924.00 $138,436.00 15382 3.9 2928 24752
Brookfield Brookfield Free Public 1098 $15,500.00 $16,300.00 4625 4.2 345 1664
Burlington Fletcher Free 42192 $1,848,859.00 $1,819,394.00 144443 3.4 13792 259272
Cabot Cabot Public 1397 $51,163.00 $51,092.00 6035 4.3 284 4940
Cambridge Varnum Memorial 3596 $42,775.00 $57,606.00 7296 2.0 755 8892
Canaan Alice M. Ward Memorial 1092 $67,850.00 $66,614.00 14875 13.6 288 7696
Castleton Castleton Free 5295 $103,294.00 $98,792.00 20586 3.9 3061 8580
Cavendish Cavendish Fletcher Community 1430 $40,774.00 $68,427.00 12974 9.1 1057 21424
Charlotte Charlotte 3739 $143,202.00 $148,148.00 14403 3.9 2253 23400
Chelsea Chelsea Public 1393 $40,143.00 $41,329.00 7641 5.5 800 7800
Chester Whiting 3149 $94,500.00 $105,707.00 12245 3.9 907 16224
Chittenden Chittenden Public 1103 $10,739.00 $12,295.00 3023 2.7 721 2704
Clarendon Bailey Memorial 2595 $21,256.00 $21,256.00 11000 4.2 1710 1820
Colchester Burnham Memorial 17083 $622,449.00 $550,433.00 47066 2.8 8513 62088
Corinth Blake Memorial 2428 $40,475.00 $45,987.00 19512 8.0 1259 7592
Cornwall Cornwall Free Public 1159 $3,688.00 $6,996.00 3368 2.9 235 520
Craftsbury Craftsbury Public 1180 $51,290.00 $79,085.00 14121 12.0 2992 19708
Danville Pope Memorial 2288 $62,916.00 $69,606.00 11728 5.1 903 6968
Derby Dailey Memorial 3737 $63,942.00 $69,659.00 11629 3.1 825 12376
Derby Line Haskell Free 2457 $98,137.00 $260,711.00 20000 8.1 1583 18044
Dorset Dorset Village Public 1989 $65,918.00 $101,984.00 24765 12.5 1007 14040
Dover Dover Free 1358 $158,890.00 $149,559.00 14494 10.7 1804 10296
Dummerston Lydia Taft Pratt 1993 $13,230.00 $17,756.00 3985 2.0 643 2496
Enosburg Enosburgh Public 2791 $63,577.00 $76,500.00 11000 3.9 2400 23400
Essex Essex Free 19506 $364,381.00 $366,336.00 30921 1.6 8383 92716
Essex Junction Brownell 9210 $653,520.00 $629,171.00 70885 7.7 5755 135720
Fairfax Fairfax Community 4226 $75,878.00 $83,130.00 39497 9.3 1419 17524
Fairfield Bent Northrup Memorial 1979 $12,353.00 $68,794.00 7726 3.9 1236 9360
Fair Haven Fair Haven Free 2766 $66,249.00 $65,037.00 17433 6.3 1413 12116
Fairlee Fairlee Public 1065 $66,161.00 $64,312.00 13462 12.6 1804 7592
Franklin Haston 1404 $38,755.00 $29,496.00 8769 6.2 662 4628
Georgia Georgia Public 4511 $76,353.00 $69,572.00 18771 4.2 2435 13260
Glover Glover Public 1088 $17,032.00 $25,224.00 6700 6.2 690 5720
Grafton Grafton Public 499 $15,739.00 $43,090.00 7699 15.4 1276 6032
Grand Isle Grand Isle Free 2073 $34,375.00 $33,315.00 9422 4.5 566 3380
Greensboro Greensboro Free 796 $69,328.00 $70,766.00 14307 18.0 3931 12116
Groton Groton Free Public 918 $31,898.00 $21,700.00 6717 7.3 300 2756
Guilford Guilford Free 2002 $37,573.00 $37,666.00 4179 2.1 315 2808
Hancock Hancock Free Public 421 $14,668.00 $14,668.00 3010 7.1 577 832
Hardwick Jeudevine Memorial 3041 $90,504.00 $86,910.00 12279 4.0 1997 15080
Hartford Hartford 4498 $79,300.00 $75,896.00 14135 3.1 1971 15444
Hartford/Quechee Quechee 4798 $184,199.00 $155,028.00 28069 5.9 3525 21112
Hartland Hartland Public 3373 $119,494.00 $118,041.00 25350 7.5 1776 26832
Highgate Highgate Public 3539 $65,052.00 $68,353.00 10050 2.8 350 7800
Hinesburg Carpenter Carse 4712 $197,737.00 $206,002.00 25700 5.5 2938 23400
Huntington Huntington Public 1957 $48,375.00 $44,952.00 11956 6.1 789 6812
Hyde Park Lanpher Memorial 2933 $55,677.00 $63,054.00 11123 3.8 806 13624
Jamaica Jamaica Memorial 945 $15,154.00 $11,872.00 6755 7.1 430 1872
Jericho Jericho Town 5008 $25,435.00 $23,813.00 7981 1.6 302 6240
Jericho/Underhill Deborah Rawson Memorial 8023 $255,552.00 $257,525.00 22470 2.8 3731 30004
Johnson Johnson Public 3409 $70,127.00 $80,173.00 9575 2.8 861 12740
Killington Sherburne Memorial 794 $232,234.00 $227,390.00 19355 24.4 1985 34580
Lincoln Lincoln 1164 $46,325.00 $62,267.00 18318 15.7 885 11440
Londonderry South Londonderry Free 1814 $49,100.00 $49,100.00 20130 11.1 1938 2964
Ludlow Fletcher Memorial 2156 $85,990.00 $163,480.00 14151 6.6 2083 33696
Lyndon Cobleigh Public 10473 $233,201.00 $252,286.00 32714 3.1 3717 86840
Manchester Mark Skinner 4363 $296,715.00 $353,563.00 18439 4.2 4185 24960
Marshfield Jaquith Public 2010 $67,701.00 $74,251.00 10697 5.3 1286 11440
Middlebury Ilsley Public 8482 $556,308.00 $585,714.00 67095 7.9 4688 219284
Middletown Springs Middletown Springs Public 695 $18,456.00 $18,928.00 5636 8.1 367 2704
Milton Milton Public 10275 $222,193.00 $222,948.00 41359 4.0 4121 38740
Monkton Russell Memorial 2024 $16,990.00 $16,858.00 4752 2.3 691 2184
Montgomery Montgomery Town 854 $21,975.00 $22,172.00 8255 9.7 554 6760
Montpelier Kellogg Hubbard 17732 $694,999.00 $977,753.00 82413 4.6 8542 247728
Moretown Moretown Memorial 1537 $20,136.00 $16,853.00 6924 4.5 516 2756
Morristown Morristown Centennial 5192 $157,564.00 $181,271.00 20334 3.9 3031 25272
Newbury Tenney Memorial 1170 $32,321.00 $45,716.00 14000 12.0 208 4680
Newbury/Wells River Baldwin Memorial 1108 $34,207.00 $34,700.00 12963 11.7 1140 7436
Newfane Moore Free 1659 $76,000.00 $69,906.00 18500 11.2 1710 6500
New Haven New Haven Community 1632 $41,552.00 $44,005.00 9808 6.0 774 5824
Newport Goodrich Memorial 7397 $202,183.00 $168,842.00 19138 2.6 5588 32396
Northfield Brown Public 6168 $114,071.00 $113,077.00 21130 3.4 1360 17680
North Hero North Hero Public 863 $34,403.00 $31,697.00 5327 6.2 437 5980
Norwich Norwich Public 3433 $261,322.00 $261,832.00 31954 9.3 3143 62400
Orwell Orwell Free Library 1108 $20,849.00 $20,485.00 9160 8.3 420 4680
Pawlet Pawlet Public 1705 $47,950.00 $38,016.00 11000 6.5 466 33800
Peacham Peacham 822 $28,630.00 $44,703.00 9159 11.1 548 9516
Pittsfield Roger Clark Memorial 534 $940.00 $490.00 3200 6.0 211 624
Pittsford Maclure 3012 $76,042.00 $115,546.00 11288 3.7 1002 40040
Plainfield Cutler Memorial 1307 $45,142.00 $48,466.00 7467 5.7 765 3380
Pomfret Abbott Memorial 968 $40,797.00 $41,162.00 5400 5.6 355 2704
Poultney Poultney Public 3446 $110,149.00 $110,149.00 14125 4.1 2492 36296
Pownal Solomon Wright Public 3528 $17,241.00 $16,311.00 13900 3.9 972 3744
Proctor Proctor Free 1812 $72,695.00 $102,526.00 20644 11.4 1763 24960
Putney Putney Public 2688 $123,464.00 $143,224.00 22219 8.3 1882 52000
Randolph Kimball Public 6136 $218,988.00 $221,320.00 20131 3.3 3782 31512
Reading Reading Public 688 $33,956.00 $26,285.00 6110 8.9 543 2288
Readsboro Readsboro Community 814 $25,432.00 $25,182.00 8216 10.1 181 6240
Richford Arvin A. Brown Public 2505 $60,680.00 $61,933.00 12714 5.1 755 7800
Richmond Richmond Free 4091 $164,638.00 $160,791.00 23684 5.8 2817 0
Rochester Rochester Public 964 $42,573.00 $60,960.00 20121 20.9 1465 5616
Rockingham Rockingham Free Public 5286 $353,939.00 $352,520.00 34541 6.5 4688 39624
Roxbury Roxbury Free 478 $16,646.00 $13,327.00 5800 12.1 402 1768
Royalton Royalton Memorial 2758 $53,355.00 $50,141.00 13308 4.8 3278 7228
Rupert R.K. Kittay Public 806 $22,626.00 $21,621.00 6000 7.4 492 416
Rutland Rutland Free 22758 $1,126,656.00 $1,093,228.00 70870 3.1 12990 131248
Saint Albans St. Albans Free 12979 $332,080.00 $332,080.00 37996 2.9 8183 74880
Saint Johnsbury St. Johnsbury Athenaeum 7638 $228,325.00 $520,908.00 24765 3.2 3844 79768
Salisbury Salisbury Free Public 1167 $5,980.00 $5,937.00 3961 3.4 109 1144
Sharon Baxter Memorial 1736 $16,046.00 $18,812.00 5454 3.1 835 2080
Shelburne Pierson 7141 $313,257.00 $315,548.00 29305 4.1 4622 51532
Shoreham Platt Memorial 1202 $39,600.00 $36,615.00 9731 8.1 903 4056
Shrewsbury Shrewsbury 1018 $29,239.00 $16,303.00 8950 8.8 296 3224
South Burlington South Burlington Community 17605 $395,931.00 $393,968.00 63093 3.6 9376 77324
South Hero South Hero Community 1738 $59,286.00 $53,705.00 23893 13.7 1908 18200
Springfield Springfield Town 9343 $642,340.00 $643,164.00 49287 5.3 4547 37648
Stamford Stamford Community 825 $77,268.00 $70,452.00 10466 12.7 459 9724
Starksboro Starksboro Public 1903 $24,791.00 $24,167.00 4554 2.4 621 3536
Stockbridge/Gaysville Belcher Memorial 560 $2,500.00 $15,283.00 1600 2.9 304 312
Stowe Stowe Free 4298 $535,369.00 $478,566.00 27736 6.5 6884 0
Strafford Morrill Mem. & Harris 1130 $44,526.00 $51,532.00 10038 8.9 477 4576
Swanton Swanton Public 6427 $121,540.00 $129,200.00 21500 3.3 589 12584
Thetford Latham Memorial 2612 $69,075.00 $78,180.00 11455 4.4 2250 11648
Thetford/Postmills George Peabody 2612 $8,653.00 $10,539.00 6665 2.6 242 936
Townshend Townshend Public 1207 $53,789.00 $53,790.00 12315 10.2 738 5668
Troy Wm. & Lucy Rand Memorial 2264 $18,276.00 $16,720.00 9006 4.0 1248 5512
Tunbridge Tunbridge Public 1183 $57,277.00 $69,829.00 9024 7.6 510 10556
Vergennes Bixby Memorial 7878 $170,635.00 $241,497.00 28890 3.7 1585 43628
Vernon Vernon Free 2248 $125,839.00 $124,833.00 16419 7.3 1109 8216
Waitsfield Joslin Memorial 2965 $73,543.00 $72,078.00 9270 3.1 1127 10400
Wallingford Gilbert Hart 2304 $42,617.00 $51,342.00 12854 5.6 443 5720
Wardsboro Wardsboro Free Public 900 $69,781.00 $60,530.00 6115 6.8 1227 5356
Warren Warren Public 1464 $87,531.00 $87,531.00 8334 5.7 794 8580
Washington Calef Memorial 1001 $33,856.00 $31,629.00 11454 11.4 668 3900
Waterbury Waterbury Public 6479 $224,061.00 $250,367.00 21329 3.3 3556 32604
Weathersfield Weathersfield Proctor 2829 $68,113.00 $67,825.00 7069 2.5 524 4576
Wells Wells Village 1255 $7,298.00 $7,785.00 6316 5.0 485 728
West Fairlee West Fairlee Free Public 677 $5,245.00 $4,190.00 4150 6.1 89 624
Westford Westford Public 2089 $54,153.00 $54,153.00 8863 4.2 847 4992
Westminster Butterfield 296 $2,004.00 $16,730.00 9748 32.9 348 1820
Westminster West Westminster West Public 3183 $14,254.00 $16,185.00 6032 1.9 697 1976
Weston Wilder Memorial 552 $23,668.00 $22,041.00 5425 9.8 N/A 1820
West Rutland West Rutland Public 2468 $56,090.00 $45,353.00 9454 3.8 902 7852
West Windsor Mary L. Blood Memorial 1130 $14,178.00 $12,170.00 4035 3.6 324 780
Whitingham Whitingham Free Public 2104 $57,865.00 $58,020.00 10513 5.0 1334 10140
Williamstown Ainsworth Public 3388 $45,537.00 $41,157.00 10577 3.1 1503 4524
Williston Dorothy Alling Memorial 8914 $558,167.00 $559,276.00 32540 3.7 4804 62036
Wilmington Pettee Memorial 2124 $121,511.00 $107,458.00 13444 6.3 2998 18356
Windsor Windsor Public 3575 $93,227.00 $103,538.00 16578 4.6 741 15808
Winhall Winhall Memorial 730 $13,200.00 $15,524.00 6300 8.6 217 1560
Winooski Winooski Memorial 7198 $116,164.00 $109,999.00 10317 1.4 2565 11648
Wolcott G. M. Kelley Community 1652 $53,611.00 $57,789.00 11500 7.0 417 11336
Woodbury Woodbury Community 912 $15,085.00 $17,806.00 8219 9.0 685 520
Woodstock Norman Williams Public 3070 $284,086.00 $404,243.00 50624 16.5 3790 58604
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment