Create a gist now

Instantly share code, notes, and snippets.

@psthomas /.block
Last active Nov 16, 2017

Embed
What would you like to do?
Wisconsin 2016 election results by county
height: 600
scrolling: yes
border: yes
year county county_num turnout pct_dem pct_rep dem_lead num_dem num_rep
2000 Adams 9116.0 0.5478 52.9 43.0 9.9 4826.0 3920.0
2004 Adams 10456.0 0.6284 52.1 46.8 5.3 5447.0 4890.0
2008 Adams 9986.0 0.6001 58.1 39.8 18.3 5806.0 3974.0
2012 Adams 10287.0 0.6033 53.9 45.1 8.8 5542.0 4644.0
2016 Adams 10158.0 0.5958 37.2 58.9 -21.7 3780.0 5983.0
2000 Ashland 7890.0 0.6353 55.2 38.5 16.7 4356.0 3038.0
2004 Ashland 9199.0 0.7407 63.1 36.0 27.1 5805.0 3313.0
2008 Ashland 8574.0 0.6903 67.9 30.7 37.2 5818.0 2634.0
2012 Ashland 8372.0 0.679 64.5 33.7 30.8 5399.0 2820.0
2016 Ashland 7986.0 0.6477 51.8 42.9 8.9 4136.0 3428.0
2000 Barron 19904.0 0.5645 44.9 49.5 -4.6 8928.0 9848.0
2004 Barron 23937.0 0.6789 48.9 50.3 -1.4 11696.0 12030.0
2008 Barron 22886.0 0.6491 52.8 45.7 7.1 12078.0 10457.0
2012 Barron 22692.0 0.6422 48.0 50.4 -2.4 10890.0 11443.0
2016 Barron 22628.0 0.6404 34.8 60.1 -25.3 7881.0 13595.0
2000 Bayfield 8259.0 0.6914 53.6 39.5 14.1 4427.0 3266.0
2004 Bayfield 9699.0 0.812 60.3 38.7 21.6 5845.0 3754.0
2008 Bayfield 9468.0 0.7926 63.1 35.5 27.6 5972.0 3365.0
2012 Bayfield 9788.0 0.8026 61.6 36.8 24.8 6033.0 3603.0
2016 Bayfield 9539.0 0.7822 51.9 43.2 8.7 4953.0 4125.0
2000 Brown 107769.0 0.6109 45.6 50.3 -4.7 49096.0 54258.0
2004 Brown 123294.0 0.6989 44.6 54.5 -9.9 54935.0 67173.0
2008 Brown 124754.0 0.7071 53.9 44.8 9.1 67269.0 55854.0
2012 Brown 128928.0 0.7066 48.5 50.3 -1.8 62526.0 64836.0
2016 Brown 128965.0 0.7068 41.4 52.1 -10.7 53358.0 67192.0
2000 Buffalo 6641.0 0.6343 48.7 45.7 3.0 3237.0 3038.0
2004 Buffalo 7591.0 0.725 52.7 46.1 6.6 3998.0 3502.0
2008 Buffalo 7000.0 0.6686 56.4 41.8 14.6 3949.0 2923.0
2012 Buffalo 7039.0 0.6755 50.7 47.8 2.9 3570.0 3364.0
2016 Buffalo 6987.0 0.6705 36.2 58.0 -21.8 2531.0 4049.0
2000 Burnett 8151.0 0.6306 44.5 48.7 -4.2 3626.0 3967.0
2004 Burnett 9321.0 0.7212 48.3 50.9 -2.6 4499.0 4743.0
2008 Burnett 8688.0 0.6722 49.9 48.3 1.6 4337.0 4200.0
2012 Burnett 8677.0 0.6995 45.9 52.4 -6.5 3986.0 4550.0
2016 Burnett 8736.0 0.7042 33.7 62.0 -28.3 2948.0 5412.0
2000 Calumet 19947.0 0.6235 41.1 54.3 -13.2 8202.0 10837.0
2004 Calumet 25276.0 0.7901 40.7 58.2 -17.5 10290.0 14721.0
2008 Calumet 26474.0 0.8276 50.2 48.1 2.1 13295.0 12722.0
2012 Calumet 26420.0 0.7336 43.5 55.0 -11.5 11489.0 14539.0
2016 Calumet 26690.0 0.7411 36.1 57.5 -21.4 9634.0 15345.0
2000 Chippewa 26173.0 0.575 46.2 49.0 -2.8 12102.0 12835.0
2004 Chippewa 30524.0 0.6706 48.3 50.6 -2.3 14751.0 15450.0
2008 Chippewa 30231.0 0.6641 53.7 44.6 9.1 16239.0 13492.0
2012 Chippewa 30932.0 0.6418 49.3 49.5 -0.2 15237.0 15322.0
2016 Chippewa 31537.0 0.6544 37.7 56.8 -19.1 11875.0 17912.0
2000 Clark 14149.0 0.6014 41.9 52.7 -10.8 5931.0 7461.0
2004 Clark 15125.0 0.6429 46.1 52.7 -6.6 6966.0 7966.0
2008 Clark 14187.0 0.6031 52.5 45.0 7.5 7454.0 6383.0
2012 Clark 13801.0 0.5799 44.7 53.7 -9.0 6172.0 7412.0
2016 Clark 13578.0 0.5705 31.1 63.7 -32.6 4225.0 8645.0
2000 Columbia 25587.0 0.6111 49.4 46.8 2.6 12636.0 11987.0
2004 Columbia 29555.0 0.7059 48.4 50.6 -2.2 14300.0 14956.0
2008 Columbia 29272.0 0.6991 56.9 41.7 15.2 16661.0 12193.0
2012 Columbia 30546.0 0.7051 56.2 42.6 13.6 17175.0 13026.0
2016 Columbia 29669.0 0.6849 45.6 47.7 -2.1 13525.0 14160.0
2000 Crawford 7394.0 0.5765 54.2 40.9 13.3 4005.0 3024.0
2004 Crawford 8459.0 0.6596 55.0 43.5 11.5 4656.0 3680.0
2008 Crawford 7981.0 0.6223 62.5 35.5 27.0 4987.0 2830.0
2012 Crawford 7817.0 0.6067 59.2 39.2 20.0 4629.0 3067.0
2016 Crawford 7742.0 0.6009 44.2 49.7 -5.5 3425.0 3844.0
2000 Dane 232739.0 0.6515 61.1 32.6 28.5 142317.0 75790.0
2004 Dane 274249.0 0.7677 66.0 33.0 33.0 181052.0 90369.0
2008 Dane 282939.0 0.792 72.8 25.8 47.0 205984.0 73065.0
2012 Dane 304181.0 0.817 71.0 27.5 43.5 216071.0 83644.0
2016 Dane 309096.0 0.8302 70.4 23.1 47.3 217506.0 71270.0
2000 Dodge 37701.0 0.5602 38.7 57.5 -18.8 14580.0 21684.0
2004 Dodge 44336.0 0.6588 37.6 61.4 -23.8 16690.0 27201.0
2008 Dodge 42823.0 0.6363 44.8 53.7 -8.9 19183.0 23015.0
2012 Dodge 44488.0 0.6483 42.2 56.7 -14.5 18762.0 25211.0
2016 Dodge 43393.0 0.6324 32.2 61.4 -29.2 13968.0 26643.0
2000 Door 15220.0 0.6778 43.1 51.3 -8.2 6560.0 7810.0
2004 Door 17491.0 0.7789 47.8 50.9 -3.1 8367.0 8910.0
2008 Door 17481.0 0.7785 58.0 40.7 17.3 10142.0 7112.0
2012 Door 17671.0 0.7788 53.0 46.0 7.0 9357.0 8121.0
2016 Door 17608.0 0.776 45.6 48.8 -3.2 8026.0 8584.0
2000 Douglas 21706.0 0.6302 62.6 31.9 30.7 13593.0 6930.0
2004 Douglas 25187.0 0.7312 65.7 33.5 32.2 16537.0 8448.0
2008 Douglas 24066.0 0.6987 65.8 32.6 33.2 15830.0 7835.0
2012 Douglas 22894.0 0.667 64.9 33.7 31.2 14863.0 7705.0
2016 Douglas 22467.0 0.6545 50.5 43.0 7.5 11342.0 9657.0
2000 Dunn 19330.0 0.5821 47.4 46.1 1.3 9172.0 8911.0
2004 Dunn 23172.0 0.6977 52.0 46.9 5.1 12039.0 10879.0
2008 Dunn 22989.0 0.6922 56.6 41.6 15.0 13002.0 9566.0
2012 Dunn 21992.0 0.6352 51.5 46.5 5.0 11316.0 10224.0
2016 Dunn 22091.0 0.6381 40.9 52.0 -11.1 9025.0 11487.0
2000 Eau Claire 47875.0 0.6317 50.3 43.7 6.6 24078.0 20921.0
2004 Eau Claire 55437.0 0.7315 54.2 44.5 9.7 30068.0 24653.0
2008 Eau Claire 55010.0 0.7258 60.3 38.1 22.2 33146.0 20959.0
2012 Eau Claire 54806.0 0.6973 56.0 42.4 13.6 30666.0 23256.0
2016 Eau Claire 54853.0 0.6979 49.7 42.5 7.2 27271.0 23301.0
2000 Florence 2405.0 0.6354 33.9 63.5 -29.6 816.0 1528.0
2004 Florence 2724.0 0.7197 36.5 62.5 -26.0 993.0 1703.0
2008 Florence 2685.0 0.7094 42.2 56.3 -14.1 1134.0 1512.0
2012 Florence 2625.0 0.7202 36.3 62.7 -26.4 953.0 1645.0
2016 Florence 2657.0 0.7289 25.1 71.4 -46.3 666.0 1897.0
2000 Fond du Lac 46589.0 0.6214 39.0 57.0 -18.0 18181.0 26548.0
2004 Fond du Lac 53036.0 0.7073 36.2 62.8 -26.6 19216.0 33291.0
2008 Fond du Lac 52323.0 0.6978 44.8 53.8 -9.0 23463.0 28164.0
2012 Fond du Lac 53402.0 0.6916 41.9 56.8 -14.9 22379.0 30355.0
2016 Fond du Lac 51822.0 0.6712 33.6 59.9 -26.3 17391.0 31044.0
2000 Forest 4716.0 0.6161 45.8 51.0 -5.2 2158.0 2404.0
2004 Forest 5153.0 0.6732 48.7 50.6 -1.9 2509.0 2608.0
2008 Forest 4683.0 0.6118 57.1 41.9 15.2 2673.0 1963.0
2012 Forest 4648.0 0.6424 52.2 46.7 5.5 2425.0 2172.0
2016 Forest 4538.0 0.6272 34.9 61.4 -26.5 1583.0 2787.0
2000 Grant 21956.0 0.5731 48.7 46.6 2.1 10691.0 10240.0
2004 Grant 25264.0 0.6595 50.9 48.3 2.6 12864.0 12208.0
2008 Grant 24320.0 0.6348 61.2 37.3 23.9 14875.0 9068.0
2012 Grant 24248.0 0.6022 56.1 42.3 13.8 13594.0 10255.0
2016 Grant 24274.0 0.6029 41.4 50.9 -9.5 10047.0 12347.0
2000 Green 15276.0 0.5723 51.5 44.4 7.1 7863.0 6790.0
2004 Green 18248.0 0.6837 52.5 46.6 5.9 9575.0 8497.0
2008 Green 18534.0 0.6944 62.1 36.3 25.8 11502.0 6730.0
2012 Green 19322.0 0.6955 58.0 40.7 17.3 11206.0 7857.0
2016 Green 18982.0 0.6833 48.1 45.8 2.3 9121.0 8693.0
2000 Green Lake 9107.0 0.6351 36.2 59.9 -23.7 3301.0 5451.0
2004 Green Lake 10178.0 0.7098 35.4 63.6 -28.2 3605.0 6472.0
2008 Green Lake 9536.0 0.665 41.9 56.6 -14.7 4000.0 5393.0
2012 Green Lake 9675.0 0.677 39.2 59.8 -20.6 3793.0 5782.0
2016 Green Lake 9411.0 0.6586 28.7 66.0 -37.3 2700.0 6210.0
2000 Iowa 10541.0 0.5969 55.4 40.0 15.4 5842.0 4221.0
2004 Iowa 12542.0 0.7102 56.8 42.6 14.2 7122.0 5348.0
2008 Iowa 11969.0 0.6777 66.7 32.0 34.7 7987.0 3829.0
2012 Iowa 12534.0 0.6987 64.7 34.2 30.5 8105.0 4287.0
2016 Iowa 12240.0 0.6823 54.5 39.3 15.2 6669.0 4809.0
2000 Iron 3507.0 0.668 46.2 49.4 -3.2 1620.0 1734.0
2004 Iron 3879.0 0.7389 50.4 48.6 1.8 1956.0 1884.0
2008 Iron 3432.0 0.6537 55.8 42.7 13.1 1914.0 1464.0
2012 Iron 3632.0 0.7323 49.1 49.3 -0.2 1784.0 1790.0
2016 Iron 3494.0 0.7044 36.4 59.8 -23.4 1273.0 2090.0
2000 Jackson 8417.0 0.5541 52.0 43.6 8.4 4380.0 3670.0
2004 Jackson 9726.0 0.6403 54.0 45.1 8.9 5249.0 4387.0
2008 Jackson 9251.0 0.609 60.2 38.4 21.8 5572.0 3552.0
2012 Jackson 9313.0 0.5865 56.9 41.9 15.0 5298.0 3900.0
2016 Jackson 9224.0 0.5809 41.4 53.2 -11.8 3821.0 4907.0
2000 Jefferson 36099.0 0.6069 42.1 53.2 -11.1 15203.0 19204.0
2004 Jefferson 42115.0 0.7081 42.6 56.5 -13.9 17925.0 23776.0
2008 Jefferson 43166.0 0.7257 49.7 48.9 0.8 21448.0 21096.0
2012 Jefferson 44281.0 0.7025 45.5 53.1 -7.6 20158.0 23517.0
2016 Jefferson 42884.0 0.6803 38.6 54.6 -16.0 16559.0 23409.0
2000 Juneau 10218.0 0.4988 47.1 48.1 -1.0 4813.0 4910.0
2004 Juneau 12379.0 0.6043 46.3 52.3 -6.0 5734.0 6473.0
2008 Juneau 11530.0 0.5629 53.7 44.6 9.1 6186.0 5148.0
2012 Juneau 11827.0 0.5655 52.8 45.8 7.0 6242.0 5411.0
2016 Juneau 11760.0 0.5623 34.9 61.1 -26.2 4100.0 7188.0
2000 Kenosha 63709.0 0.55 50.9 45.3 5.6 32429.0 28891.0
2004 Kenosha 76428.0 0.6598 52.5 46.6 5.9 40107.0 35587.0
2008 Kenosha 78789.0 0.6802 58.2 40.1 18.1 45836.0 31609.0
2012 Kenosha 80897.0 0.67 55.5 43.2 12.3 44867.0 34977.0
2016 Kenosha 76894.0 0.6368 46.5 46.9 -0.4 35770.0 36025.0
2000 Kewaunee 10084.0 0.6523 46.3 48.4 -2.1 4670.0 4883.0
2004 Kewaunee 11273.0 0.7292 45.9 53.0 -7.1 5175.0 5970.0
2008 Kewaunee 10787.0 0.6977 54.7 43.7 11.0 5902.0 4711.0
2012 Kewaunee 11037.0 0.7046 46.7 52.1 -5.4 5153.0 5747.0
2016 Kewaunee 10758.0 0.6868 33.7 61.5 -27.8 3623.0 6616.0
2000 La Crosse 55559.0 0.6443 51.2 43.8 7.4 28455.0 24327.0
2004 La Crosse 62136.0 0.7205 53.4 45.5 7.9 33170.0 28289.0
2008 La Crosse 63218.0 0.7331 60.9 37.5 23.4 38524.0 23701.0
2012 La Crosse 63462.0 0.6976 57.8 40.6 17.2 36693.0 25751.0
2016 La Crosse 63635.0 0.6995 50.9 41.5 9.4 32402.0 26384.0
2000 Lafayette 7263.0 0.6116 51.1 45.9 5.2 3710.0 3336.0
2004 Lafayette 8388.0 0.7064 52.5 46.8 5.7 4402.0 3929.0
2008 Lafayette 7831.0 0.6595 60.4 38.1 22.3 4732.0 2984.0
2012 Lafayette 7952.0 0.6428 57.0 41.7 15.3 4536.0 3314.0
2016 Lafayette 7618.0 0.6158 43.2 52.2 -9.0 3288.0 3977.0
2000 Langlade 9721.0 0.6166 43.2 52.7 -9.5 4199.0 5125.0
2004 Langlade 11074.0 0.7024 42.9 56.3 -13.4 4751.0 6235.0
2008 Langlade 10402.0 0.6598 49.8 48.8 1.0 5182.0 5081.0
2012 Langlade 10519.0 0.6811 43.5 55.3 -11.8 4573.0 5816.0
2016 Langlade 10127.0 0.6557 32.2 63.6 -31.4 3260.0 6436.0
2000 Lincoln 14239.0 0.6232 46.8 47.2 -0.4 6664.0 6727.0
2004 Lincoln 15700.0 0.6871 47.7 51.1 -3.4 7484.0 8024.0
2008 Lincoln 15268.0 0.6682 55.2 42.7 12.5 8424.0 6519.0
2012 Lincoln 15216.0 0.677 49.7 49.0 0.7 7563.0 7455.0
2016 Lincoln 14705.0 0.6543 36.5 57.1 -20.6 5370.0 8400.0
2000 Manitowoc 38824.0 0.631 45.5 49.9 -4.4 17667.0 19358.0
2004 Manitowoc 44160.0 0.7177 46.8 52.1 -5.3 20652.0 23027.0
2008 Manitowoc 42414.0 0.6893 52.9 45.3 7.6 22428.0 19234.0
2012 Manitowoc 42617.0 0.682 47.9 50.7 -2.8 20403.0 21604.0
2016 Manitowoc 40238.0 0.6439 36.2 57.7 -21.5 14563.0 23234.0
2000 Marathon 58374.0 0.6088 45.5 49.5 -4.0 26546.0 28883.0
2004 Marathon 68059.0 0.7098 45.4 53.5 -8.1 30899.0 36394.0
2008 Marathon 67940.0 0.7086 53.5 44.7 8.8 36367.0 30345.0
2012 Marathon 69862.0 0.6949 46.3 52.4 -6.1 32363.0 36617.0
2016 Marathon 69511.0 0.6914 38.1 56.1 -18.0 26476.0 39010.0
2000 Marinette 19921.0 0.5962 43.6 52.9 -9.3 8676.0 10535.0
2004 Marinette 22270.0 0.6665 45.8 53.3 -7.5 10190.0 11866.0
2008 Marinette 21255.0 0.6361 52.7 45.8 6.9 11195.0 9726.0
2012 Marinette 20777.0 0.6298 47.6 51.1 -3.5 9882.0 10619.0
2016 Marinette 19985.0 0.6058 31.2 65.0 -33.8 6243.0 12995.0
2000 Marquette 7194.0 0.6143 47.8 49.0 -1.2 3437.0 3522.0
2004 Marquette 8477.0 0.7239 44.7 54.3 -9.6 3785.0 4604.0
2008 Marquette 7846.0 0.67 51.8 46.6 5.2 4068.0 3654.0
2012 Marquette 8105.0 0.6712 49.5 49.3 0.2 4014.0 3992.0
2016 Marquette 7870.0 0.6518 35.7 59.9 -24.2 2808.0 4712.0
2000 Menominee 1233.0 0.401 77.0 18.2 58.8 949.0 225.0
2004 Menominee 1710.0 0.5561 82.6 16.8 65.8 1412.0 288.0
2008 Menominee 1448.0 0.4709 86.8 12.8 74.0 1257.0 185.0
2012 Menominee 1377.0 0.4582 86.5 13.0 73.5 1191.0 179.0
2016 Menominee 1279.0 0.4256 78.4 21.0 57.4 1003.0 269.0
2000 Milwaukee 433537.0 0.6488 58.2 37.7 20.5 252329.0 163491.0
2004 Milwaukee 482236.0 0.7217 61.7 37.4 24.3 297653.0 180287.0
2008 Milwaukee 475192.0 0.7111 67.3 31.4 35.9 319819.0 149445.0
2012 Milwaukee 492576.0 0.7312 67.5 31.5 36.0 332438.0 154924.0
2016 Milwaukee 440698.0 0.6542 65.6 28.6 37.0 288986.0 126091.0
2000 Monroe 16335.0 0.5266 45.7 50.3 -4.6 7460.0 8217.0
2004 Monroe 19554.0 0.6304 45.9 53.1 -7.2 8973.0 10375.0
2008 Monroe 19152.0 0.6174 53.2 45.2 8.0 10198.0 8666.0
2012 Monroe 19485.0 0.5919 48.8 49.7 -0.9 9515.0 9675.0
2016 Monroe 19769.0 0.6005 35.6 57.9 -22.3 7047.0 11442.0
2000 Oconto 16596.0 0.5765 43.7 52.5 -8.8 7260.0 8706.0
2004 Oconto 19794.0 0.6875 43.1 55.8 -12.7 8534.0 11043.0
2008 Oconto 18968.0 0.6588 52.3 46.2 6.1 9927.0 8755.0
2012 Oconto 19859.0 0.6755 44.6 54.1 -9.5 8865.0 10741.0
2016 Oconto 19956.0 0.6788 29.5 66.4 -36.9 5886.0 13255.0
2000 Oneida 18891.0 0.6447 44.1 50.4 -6.3 8339.0 9512.0
2004 Oneida 22039.0 0.7522 47.5 51.5 -4.0 10464.0 11351.0
2008 Oneida 21927.0 0.7484 54.3 43.9 10.4 11907.0 9630.0
2012 Oneida 21652.0 0.7407 48.3 50.4 -2.1 10452.0 10917.0
2016 Oneida 21023.0 0.7192 38.5 55.5 -17.0 8103.0 11677.0
2000 Outagamie 75742.0 0.5958 43.2 52.1 -8.9 32735.0 39460.0
2004 Outagamie 90050.0 0.7084 44.6 54.3 -9.7 40169.0 48903.0
2008 Outagamie 91563.0 0.7203 54.9 43.3 11.6 50294.0 39677.0
2012 Outagamie 94596.0 0.7197 48.3 50.1 -1.8 45659.0 47372.0
2016 Outagamie 95162.0 0.7241 40.1 54.2 -14.1 38117.0 51579.0
2000 Ozaukee 47751.0 0.7493 31.5 65.2 -33.7 15030.0 31155.0
2004 Ozaukee 53032.0 0.8322 33.4 65.8 -32.4 17714.0 34904.0
2008 Ozaukee 53365.0 0.8374 38.6 60.3 -21.7 20579.0 32172.0
2012 Ozaukee 55817.0 0.8444 34.3 64.6 -30.3 19159.0 36077.0
2016 Ozaukee 54551.0 0.8252 37.0 55.8 -18.8 20167.0 30458.0
2000 Pepin 3664.0 0.6543 50.6 44.5 6.1 1854.0 1631.0
2004 Pepin 4066.0 0.7261 53.6 45.6 8.0 2181.0 1853.0
2008 Pepin 3771.0 0.6734 55.7 42.9 12.8 2102.0 1616.0
2012 Pepin 3699.0 0.6489 50.7 48.5 2.2 1876.0 1794.0
2016 Pepin 3746.0 0.6572 35.9 59.5 -23.6 1345.0 2228.0
2000 Pierce 17962.0 0.582 47.7 45.5 2.2 8559.0 8169.0
2004 Pierce 21876.0 0.7089 51.1 47.7 3.4 11176.0 10437.0
2008 Pierce 22107.0 0.7164 53.4 44.4 9.0 11803.0 9812.0
2012 Pierce 21020.0 0.6643 48.7 49.5 -0.8 10235.0 10397.0
2016 Pierce 21127.0 0.6677 39.7 53.3 -13.6 8380.0 11261.0
2000 Polk 19762.0 0.5893 45.3 48.4 -3.1 8961.0 9557.0
2004 Polk 23503.0 0.7008 47.5 51.5 -4.0 11173.0 12095.0
2008 Polk 22643.0 0.6752 48.0 49.8 -1.8 10876.0 11282.0
2012 Polk 22573.0 0.6738 44.6 53.6 -9.0 10073.0 12094.0
2016 Polk 22794.0 0.6804 33.2 60.8 -27.6 7568.0 13864.0
2000 Portage 33760.0 0.6347 53.1 39.1 14.0 17942.0 13214.0
2004 Portage 38961.0 0.7325 56.1 42.5 13.6 21861.0 16546.0
2008 Portage 39422.0 0.7412 63.0 35.0 28.0 24817.0 13810.0
2012 Portage 39337.0 0.7133 56.1 42.2 13.9 22075.0 16615.0
2016 Portage 38402.0 0.6964 48.2 45.1 3.1 18524.0 17310.0
2000 Price 7930.0 0.6789 43.0 52.2 -9.2 3413.0 4136.0
2004 Price 8763.0 0.7503 49.6 49.2 0.4 4349.0 4312.0
2008 Price 8194.0 0.7015 55.6 42.2 13.4 4559.0 3461.0
2012 Price 7901.0 0.7004 49.2 49.2 0.0 3887.0 3884.0
2016 Price 7561.0 0.6703 35.3 60.3 -25.0 2671.0 4562.0
2000 Racine 88865.0 0.6172 46.8 49.5 -2.7 41563.0 44014.0
2004 Racine 101569.0 0.7055 47.5 51.6 -4.1 48229.0 52456.0
2008 Racine 100642.0 0.699 53.1 45.7 7.4 53408.0 45954.0
2012 Racine 103364.0 0.7262 51.3 47.7 3.6 53008.0 49347.0
2016 Racine 94921.0 0.6668 44.8 49.1 -4.3 42506.0 46620.0
2000 Richland 8293.0 0.6027 46.3 48.2 -1.9 3837.0 3994.0
2004 Richland 9420.0 0.6846 47.8 51.3 -3.5 4501.0 4836.0
2008 Richland 8450.0 0.6141 59.7 39.0 20.7 5041.0 3298.0
2012 Richland 8655.0 0.6352 57.4 41.3 16.1 4969.0 3573.0
2016 Richland 7982.0 0.5858 44.8 50.4 -5.6 3577.0 4021.0
2000 Rock 70404.0 0.6104 57.5 39.0 18.5 40472.0 27467.0
2004 Rock 80479.0 0.6977 57.9 41.2 16.7 46598.0 33151.0
2008 Rock 79169.0 0.6864 63.8 34.6 29.2 50529.0 27364.0
2012 Rock 80690.0 0.6891 61.0 37.8 23.2 49219.0 30517.0
2016 Rock 76056.0 0.6495 51.7 41.4 10.3 39336.0 31483.0
2000 Rusk 7366.0 0.6615 42.9 51.0 -8.1 3161.0 3758.0
2004 Rusk 7927.0 0.7119 48.2 50.3 -2.1 3820.0 3985.0
2008 Rusk 7272.0 0.6531 53.0 44.7 8.3 3855.0 3253.0
2012 Rusk 7191.0 0.6367 47.2 51.1 -3.9 3397.0 3676.0
2016 Rusk 7064.0 0.6254 30.7 64.6 -33.9 2171.0 4564.0
2000 Sauk 25653.0 0.5884 50.8 45.2 5.6 13035.0 11586.0
2004 Sauk 30417.0 0.6977 51.6 47.4 4.2 15708.0 14415.0
2008 Sauk 30626.0 0.7025 60.8 37.8 23.0 18617.0 11562.0
2012 Sauk 31927.0 0.6821 58.7 40.2 18.5 18736.0 12838.0
2016 Sauk 34323.0 0.7332 46.8 46.2 0.6 16050.0 15871.0
2000 Sawyer 7767.0 0.5855 42.9 51.1 -8.2 3333.0 3972.0
2004 Sawyer 9453.0 0.7126 46.7 52.4 -5.7 4411.0 4951.0
2008 Sawyer 9085.0 0.6849 52.4 46.2 6.2 4765.0 4199.0
2012 Sawyer 9025.0 0.6895 49.7 49.2 0.5 4486.0 4442.0
2016 Sawyer 9120.0 0.6967 38.4 56.9 -18.5 3504.0 5185.0
2000 Shawano 17603.0 0.5635 41.7 54.2 -12.5 7335.0 9548.0
2004 Shawano 20999.0 0.6722 41.2 57.9 -16.7 8657.0 12150.0
2008 Shawano 20089.0 0.6431 51.1 47.5 3.6 10259.0 9538.0
2012 Shawano 20279.0 0.6309 44.4 54.4 -10.0 9000.0 11022.0
2016 Shawano 19751.0 0.6144 30.7 64.5 -33.8 6056.0 12742.0
2000 Sheboygan 55201.0 0.6551 42.7 53.7 -11.0 23569.0 29648.0
2004 Sheboygan 62625.0 0.7432 44.1 55.0 -10.9 27608.0 34458.0
2008 Sheboygan 62107.0 0.7371 48.9 49.6 -0.7 30395.0 30801.0
2012 Sheboygan 62651.0 0.7321 44.6 54.4 -9.8 27918.0 34072.0
2016 Sheboygan 59207.0 0.6918 38.2 54.7 -16.5 22636.0 32368.0
2000 St. Croix 29954.0 0.5115 43.7 50.9 -7.2 13077.0 15240.0
2004 St. Croix 41835.0 0.7143 44.9 54.2 -9.3 18784.0 22679.0
2008 St. Croix 44821.0 0.7653 47.2 51.0 -3.8 21177.0 22837.0
2012 St. Croix 46225.0 0.7422 43.1 55.2 -12.1 19910.0 25503.0
2016 St. Croix 47415.0 0.7613 36.9 55.1 -18.2 17496.0 26123.0
2000 Taylor 8992.0 0.6148 36.2 58.7 -22.5 3254.0 5278.0
2004 Taylor 9543.0 0.6525 40.1 58.5 -18.4 3829.0 5582.0
2008 Taylor 9346.0 0.639 48.8 49.1 -0.3 4563.0 4586.0
2012 Taylor 9512.0 0.6143 39.6 58.9 -19.3 3763.0 5601.0
2016 Taylor 9448.0 0.6101 25.4 69.7 -44.3 2398.0 6589.0
2000 Trempealeau 12168.0 0.5864 54.9 41.1 13.8 6678.0 5002.0
2004 Trempealeau 14062.0 0.6777 57.4 41.8 15.6 8075.0 5878.0
2008 Trempealeau 13314.0 0.6416 62.5 36.1 26.4 8321.0 4808.0
2012 Trempealeau 13481.0 0.6301 56.4 42.3 14.1 7605.0 5707.0
2016 Trempealeau 13645.0 0.6378 41.4 54.0 -12.6 5645.0 7370.0
2000 Vernon 13044.0 0.6114 50.4 43.6 6.8 6577.0 5684.0
2004 Vernon 14845.0 0.6958 53.4 45.6 7.8 7924.0 6774.0
2008 Vernon 14075.0 0.6597 60.1 38.1 22.0 8463.0 5367.0
2012 Vernon 14269.0 0.6443 56.4 41.6 14.8 8044.0 5942.0
2016 Vernon 14213.0 0.6418 44.7 49.2 -4.5 6351.0 6994.0
2000 Vilas 12322.0 0.6924 38.2 56.5 -18.3 4706.0 6958.0
2004 Vilas 14002.0 0.7869 40.8 58.2 -17.4 5713.0 8155.0
2008 Vilas 13750.0 0.7727 47.2 51.3 -4.1 6491.0 7055.0
2012 Vilas 13842.0 0.7869 43.0 56.0 -13.0 5951.0 7749.0
2016 Vilas 13606.0 0.7735 35.1 60.0 -24.9 4769.0 8169.0
2000 Walworth 40458.0 0.5492 38.3 56.8 -18.5 15492.0 22982.0
2004 Walworth 48446.0 0.6577 39.6 59.4 -19.8 19177.0 28754.0
2008 Walworth 50422.0 0.6845 47.9 50.5 -2.6 24177.0 25485.0
2012 Walworth 52303.0 0.6905 43.1 55.5 -12.4 22552.0 29006.0
2016 Walworth 51319.0 0.6775 36.5 56.2 -19.7 18706.0 28848.0
2000 Washburn 8045.0 0.6162 45.9 48.6 -2.7 3695.0 3912.0
2004 Washburn 9567.0 0.7328 49.2 49.8 -0.6 4705.0 4762.0
2008 Washburn 9112.0 0.698 51.5 47.2 4.3 4693.0 4303.0
2012 Washburn 9287.0 0.7394 47.9 50.6 -2.7 4447.0 4699.0
2016 Washburn 9130.0 0.7269 36.0 59.2 -23.2 3283.0 5404.0
2000 Washington 61412.0 0.6419 29.5 67.0 -37.5 18115.0 41162.0
2004 Washington 72467.0 0.7575 29.3 69.9 -40.6 21234.0 50641.0
2008 Washington 74411.0 0.7778 34.6 64.1 -29.5 25719.0 47729.0
2012 Washington 78742.0 0.788 29.4 69.5 -40.1 23166.0 54765.0
2016 Washington 77551.0 0.7761 26.9 66.7 -39.8 20854.0 51729.0
2000 Waukesha 203734.0 0.7254 31.6 65.3 -33.7 64319.0 133105.0
2004 Waukesha 230363.0 0.8202 32.0 67.3 -35.3 73626.0 154926.0
2008 Waukesha 232897.0 0.8292 36.6 62.3 -25.7 85339.0 145152.0
2012 Waukesha 243856.0 0.83 32.3 66.8 -34.5 78779.0 162798.0
2016 Waukesha 237588.0 0.8086 33.3 60.0 -26.7 79199.0 142519.0
2000 Waupaca 22804.0 0.5751 38.5 56.9 -18.4 8787.0 12980.0
2004 Waupaca 26974.0 0.6802 40.0 59.1 -19.1 10792.0 15941.0
2008 Waupaca 25511.0 0.6433 50.8 47.9 2.9 12952.0 12232.0
2012 Waupaca 25840.0 0.641 44.8 54.2 -9.4 11578.0 14002.0
2016 Waupaca 25707.0 0.6377 32.6 62.3 -29.7 8383.0 16013.0
2000 Waushara 10248.0 0.5344 41.4 54.4 -13.0 4239.0 5571.0
2004 Waushara 12246.0 0.6386 42.9 56.2 -13.3 5257.0 6888.0
2008 Waushara 11849.0 0.6179 49.5 48.7 0.8 5868.0 5770.0
2012 Waushara 12048.0 0.6202 44.3 54.5 -10.2 5335.0 6562.0
2016 Waushara 11979.0 0.6167 31.7 64.0 -32.3 3802.0 7669.0
2000 Winnebago 76080.0 0.6125 44.7 50.4 -5.7 33983.0 38330.0
2004 Winnebago 88596.0 0.7133 46.2 52.5 -6.3 40943.0 46542.0
2008 Winnebago 87677.0 0.7059 54.9 43.3 11.6 48167.0 37946.0
2012 Winnebago 89173.0 0.6833 51.0 47.2 3.8 45449.0 42122.0
2016 Winnebago 87140.0 0.6677 42.5 49.9 -7.4 37054.0 43447.0
2000 Wood 35761.0 0.6339 44.6 49.8 -5.2 15936.0 17803.0
2004 Wood 40071.0 0.7103 47.3 51.4 -4.1 18950.0 20592.0
2008 Wood 39052.0 0.6922 55.6 42.5 13.1 21710.0 16581.0
2012 Wood 38900.0 0.6818 47.8 50.7 -2.9 18581.0 19704.0
2016 Wood 37712.0 0.661 37.7 57.0 -19.3 14232.0 21502.0
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Election: Wisconsin 2016</title>
<!--<script type="text/javascript" src="../d3/d3.v3.min.js"></script>-->
<script src="https://d3js.org/d3.v4.min.js"></script>
<style type="text/css">
.axis {
font: 12px sans-serif;
}
.axis path,
.axis line {
fill: none;
stroke: #aaa;
shape-rendering: crispEdges;
}
.axis text {
fill: #858585;
}
.title {
font: 500 100px serif; /*180px "Helvetica Neue"*/
fill: #e5e5e5;
}
.party {
font: 500 35px serif; /*180px "Helvetica Neue" "PT Sans"*/
fill: #e5e5e5;
}
.incr {
font: 500 35px serif; /* sans-serif"Helvetica Neue"; 55px + - */
fill: #e5e5e5;
cursor: pointer;
}
.incr:hover {
fill: #ccc;
}
.circle {
stroke: gray; /* #e5e5e5 */
cursor: pointer;
}
.circle:hover {
/*stroke: black;*/
fill-opacity: 0.8;
}
svg {
margin-top: 2.5em;
margin-bottom: 2.5em;
}
.tooltip {
/*border: 1px solid #999;*/
/*line-height: 1;*/
font: 16px serif;/*18px serif "Helvetica Neuesans-serif; "PT Sans"*/
/*font-weight: bold;*/
/*padding: 5px;*/
/*background: #fcfcfa;*/ /*rgba(0, 0, 0, 0.8) */
color: #999; /*#fff #888; #999*/
/*border-radius: 2px;*/
max-width: 400px;
}
body > p, li > p {
line-height: 1.5em;
}
body > p {
width: 800px;
}
</style>
</head>
<body>
<script type="text/javascript">
var margin = {top: 20, right: 20, bottom: 50, left: 30},
width = 1100 - margin.left - margin.right,
height = 600 - margin.top - margin.bottom;
// width = 850 - margin.left - margin.right,
// height = 450 - margin.top - margin.bottom;
//Formatting Functions
var pctFormat = d3.format(".1%")
var thsdFormat = d3.format(",")
//Create SVG
var svg = d3.select("body").append("svg")
.attr("width", width + margin.left + margin.right)
.attr("height", height + margin.top + margin.bottom)
//.attr("style", "outline: 1.5px solid #e5e5e5;")
.append("g")
.attr("transform", "translate(" + margin.left + "," + margin.top + ")");
//Year Title
var title = svg.append("text")
.attr("class", "title")
.attr("dy", height-10)
.attr("dx", ".35em");
var demtext = svg.append("text")
.attr("class", "party")
.attr("dy", height-50)
.attr("dx", 243);
var reptext = svg.append("text")
.attr("class", "party")
.attr("dy", height-14)
.attr("dx", 243);
//Define static scales
var xScale = d3.scaleLinear()
.domain([-80, 80]) //-100, 100
.range([0, width]);
var yScale = d3.scaleLinear()
.domain([0, 100]) //Max margin is 100
.range([height, 0]);
//Base the color scale on the democratic margin.
var colorScale = d3.scaleLinear()
.domain([-80, 0, 80])
//.domain([d3.min(...), 0, d3.max(data, function(d) {return d.; })])
.range(['#EF3B2C', '#FFFFFF', '#08519C'])
// .range(['#FF0000', '#FFFFFF', '#0000FF'])
.interpolate(d3.interpolateRgb);
//Define x, y axes
var xAxis = d3.axisBottom(xScale);
var yAxis = d3.axisLeft(yScale);
//Append Axes
svg.append("g")
.attr("class", "axis")
.attr("transform", "translate(0," + height + ")")
.call(xAxis)
.append("text")
.attr("y", "3em")
.attr("x", width/2)
.text("Democratic Margin (%)");
svg.append("g")
.attr("class", "axis")
.call(yAxis)
.attr("transform", "translate(" + (width/2) + ",0)")
.append("text")
.attr("transform", "rotate(-90)")
.attr("y", 6)
.attr("dy", "-3.75em")
.style("text-anchor", "end")
.text("Turnout (%VAP)");
//Statically place tooltip:
//http://stackoverflow.com/questions/30051141
var tooltip = d3.select("body")
.append("div")
.style("position", "absolute")
.style("visibility", "hidden")
// .style("left", width/2 + margin.left + 8 + "px")
// .style("top", height - margin.bottom + 8 + "px")
.style("left", width/2 + margin.left + 8 + "px")
.style("top", height - margin.bottom/3 + "px")
.attr("class", "tooltip");
function tooltipOn(d) {
//Transition might prevent mouseout from registering
// tooltip.transition()
// .duration(500)
// .style("visibility", "visible");
//"Turnout: " + pctFormat((d.num_rep+d.num_dem)/(d.county_num/d.turnout))
//d.county_num + "," + d.turnout + "," + d.vap
tooltip.style("visibility", "visible")
.html(
"County: " + d.county + "<br>" +
"D: " + pctFormat(d.num_dem/d.county_num) +
" R: " + pctFormat(d.num_rep/d.county_num) + "<br>" +
"Turnout: " + pctFormat(d.turnout) + "<br>" +
"Voters: " + thsdFormat(Math.round(d.county_num)) + "<br>" );
}
function parseRows(d) {
return {'county': d.county, 'county_num': +d.county_num, 'turnout': +d.turnout,
'num_rep': +d.num_rep, 'num_dem': +d.num_dem, 'year': +d.year,
'vap': +d.county_num/+d.turnout};
}
d3.csv('county_results_20002016.csv', parseRows, function(error, data) {
if (error) {throw error};
var dataset = d3.nest()
.key(function(d) { return +d.year; })
.entries(data);
var years = [];
for (var i=0; i<dataset.length; i++) {
years.push(+dataset[i].key)
}
var year = years[0];
//Create a copy, so it can be edited on drag:
//var yearData = Object.assign({}, getYearData(dataset, year));
var yearData = copyObj(getYearData(dataset, year));
//Data is just array of all objects from csv
var rScale = d3.scaleLinear()
.domain([0, d3.max(data, function(d) {return d.county_num; })])
.range([5, 50]);
//Append increment buttons
var incr = svg.append("text")
.attr("class", "incr")
.attr("dy", height-43) // 1em
.attr("dx", 0) //.5em
.html("&#9650;")
.on("click", function() {
year += 4;
if (year > years[years.length - 1]) {
year = years[0]
}
//Assign to new object, update circles:
yearData = copyObj(getYearData(dataset, year));
update(yearData, year);
});
var decr = svg.append("text")
.attr("class", "incr")
.attr("dy", height-10)
.attr("dx", 0) //".5em"
.html("&#9660;")
.on("click", function() {
year -= 4;
if (year < years[0]) {
year = years[years.length - 1];
}
//Assign to new object, update:
yearData = copyObj(getYearData(dataset, year));
update(yearData, year);
});
//Dragging behavior
//https://bl.ocks.org/mbostock/6123708
var drag = d3.drag()
.on("drag", dragged)
.on("end", ended);
function dragged(d) {
//Remove transitions temporarily
d3.selectAll("circle").transition();
//Issue when dragged across 0 threshold, county_num = 0
if (d3.event.y >= height) {
return;
}
//Relocate circle with mouse
d3.select(this).attr("cx", d.x = d3.event.x).attr("cy", d.y = d3.event.y);
//Avoid case of no shift
if (d.x === undefined || d.y === undefined) {
return;
}
var newMargin = xScale.invert(d.x)/100,
newTurnout = yScale.invert(d.y)/100, //Math.abs() d.y
oldMargin = (d.num_dem-d.num_rep)/d.county_num,
marginChange = newMargin-oldMargin,
dfrac = d.num_dem/d.county_num,
rfrac = d.num_rep/d.county_num;
//Recalculate fractions based on margin change
//Half goes to each side, zero sum
dfrac += marginChange/2;
rfrac -= marginChange/2;
//Add increses in turnout to county_num
//Assume change in turnout affects D&R equally
//d.county_num = newTurnout*vap;
d.county_num = newTurnout*d.vap;
// Recalculate based on margin change first, assumes
// margin changes are zero sum between parties.
d.num_dem = dfrac*d.county_num;
d.num_rep = rfrac*d.county_num;
d.turnout = newTurnout;
//Call the tooltip function each time to update.
tooltipOn(d);
//Update score as well:
updateScore(yearData);
//Wait to update circles until ended below
//update(yearData, d.year);
}
function ended(d) {
//Update circle radius, color at end of drag.
update(yearData, d.year);
}
function updateScore(yearData) {
//Could get this data directly from dataframe,
//but want to calculate so can be updated easily on drag.
var sums = [0,0,0];
for (var i=0; i<yearData.length; i++) {
sums[0] += yearData[i].num_dem;
sums[1] += yearData[i].num_rep;
sums[2] += yearData[i].county_num;
}
var dfrac = sums[0]/sums[2],
rfrac = sums[1]/sums[2];
//update dfrac rfrac text, update color background
demtext.text('D ' + pctFormat(dfrac))
reptext.text('R ' + pctFormat(rfrac))
//demtext.style('color', 'red')
if (dfrac > rfrac) {
demtext.style('fill', '#bbb');
reptext.style('fill', null);
} else {
demtext.style('fill', null);
reptext.style('fill', '#bbb');
}
//Optional, set background color based on winner
// var backColor = dfrac > rfrac ? colorScale(5) : colorScale(-5);
// //var backColor = colorScale((dfrac-rfrac)*100);
// d3.selectAll('svg')
// .style('background-color', backColor);
}
function update(yearData, year) {
//Change D,R scores:
updateScore(yearData);
//Update title
title.text(year);
//Create any new circles
var circles = svg.selectAll("circle")
.data(yearData)
.enter()
.append("circle")
.attr("class", "circle")
.attr("cx", function(d) {
return xScale(((d.num_dem-d.num_rep)/d.county_num)*100);
})
.attr("cy", function(d) {
return yScale(d.turnout*100);
})
.attr("r", function(d) {
return rScale(d.county_num);
})
.attr("fill",function(d){
return colorScale(((d.num_dem-d.num_rep)/d.county_num)*100);
})
.call(drag)
.on("mouseover", tooltipOn)
.on("mouseout", function(d){return tooltip.style("visibility", "hidden");});
//Update circles
svg.selectAll("circle").data(yearData)
.transition()
.duration(750)
.attr("class", "circle")
.attr("cx", function(d) {
return xScale(((d.num_dem-d.num_rep)/d.county_num)*100);
})
.attr("cy", function(d) {
return yScale(d.turnout*100);
})
.attr("r", function(d) {
return rScale(d.county_num);
})
.attr("fill",function(d){
return colorScale(((d.num_dem-d.num_rep)/d.county_num)*100);
});
}
//Initialize scatterplot
update(yearData, year);
// Helper functions:
function copyObj(original) {
return JSON.parse(JSON.stringify(original));
}
function getYearData(dataset, year) {
for (var i=0; i<dataset.length; i++) {
if (Number(dataset[i].key) === year) {
return dataset[i].values;
}
}
}
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment