Skip to content

Instantly share code, notes, and snippets.

@CindyJonesHulfachor
Created May 4, 2015 21:15
Show Gist options
  • Save CindyJonesHulfachor/d8eb594a617a269cf9b1 to your computer and use it in GitHub Desktop.
Save CindyJonesHulfachor/d8eb594a617a269cf9b1 to your computer and use it in GitHub Desktop.
HPV vaccinations of males 13 to 17 years old. Males with recommended three doses, shown by states that recommend vaccination.
StateLocal female3doses male3doses
United States 37.6 13.9
Connecticut 40.1 23.4
Maine 45.8 17.6
Massachusetts 39.3 21.8
New Hampshire 43.2 17.8
Rhode Island 56.5 43.2
Vermont 42.7 21.7
New Jersey 31.4 14.2
New York 45.4 19.1
NY City of New York 45.2 29.6
NY Rest of State 45.6 12.5
Delaware 51.7 18.1
Dist of Columbia 30.2 24.5
Maryland 33.4 0
Pennsylvania 45.9 15.4
PA Philadelphia 54.5 15.8
PA Rest of State 44.7 15.4
Virginia 27.6 0
West Virginia 38.4 15.1
Alabama 39.6 0
Florida 34.3 13.2
Georgia 33.2 15.3
Kentucky 26.8 0
Mississippi 25.2 0
North Carolina 32.8 12.4
South Carolina 40.7 0
Tennessee 35.9 0
Illinois 33.8 16.5
IL City of Chicago 38.6 19.8
IL Rest of State 32.6 15.8
Indiana 34.6 8.1
Michigan 34.5 7.7
Minnesota 37.6 8.6
Ohio 35 14.7
Wisconsin 36.8 13.7
Arkansas 24.4 0
Louisiana 42.1 13.5
New Mexico 44.3 19.2
Oklahoma 35.4 17.3
Texas 38.9 15
TX Bexar County 32.5 9.6
TX City of Houston 33.9 17.5
TX Rest of State 39.8 15.2
Iowa 41.9 13.7
Kansas 21 0
Missouri 28.8 0
Nebraska 41.5 19.7
Colorado 39.1 9.9
Montana 28.3 9.4
North Dakota 41.1 18.4
South Dakota 42.3 8.4
Utah 20.5 0
Wyoming 42.1 8.4
Arizona 37.4 19.5
California 45.8 16.6
Hawaii 34.4 15.1
Nevada 27.4 7.3
Alaska 27.1 8.5
Idaho 31.3 0
Oregon 39.5 12.2
Washington 45.3 12.5
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Setting Attribute Values from Data</title>
<script type="text/javascript" src="../d3.v3.js"></script>
<style type="text/css">
body {
background-color: #ddddff;
}
svg {
background-color: white;
}
</style>
</head>
<body>
<script type="text/javascript">
var svg = d3.select("body")
.append("svg")
.attr("width", 400)
.attr("height", 600);
d3.csv("hpvvaccinations.csv", function(data) {
data.sort(function(a, b) {
//return d3.descending(a.male3doses, b.male3doses);
return d3.descending(+a.male3doses, +b.male3doses); //to fix sorting
});
var rects = svg.selectAll("rect")
.data(data)
.enter()
.append("rect");
rects.attr("x", 0)
.attr("y", function(d, i) {
return i * 10;
})
.attr("width", function(d) {
return d.male3doses * 8;
})
.attr("height", 8);
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment