{"id":1259,"date":"2024-07-02T07:00:19","date_gmt":"2024-07-02T12:00:19","guid":{"rendered":"https:\/\/wollen.org\/blog\/?p=1259"},"modified":"2025-04-24T01:50:23","modified_gmt":"2025-04-24T06:50:23","slug":"the-60th-anniversary-of-the-1964-civil-rights-act","status":"publish","type":"post","link":"https:\/\/wollen.org\/blog\/2024\/07\/the-60th-anniversary-of-the-1964-civil-rights-act\/","title":{"rendered":"The 60th Anniversary of the 1964 Civil Rights Act"},"content":{"rendered":"<p>Today marks 60 years since the Civil Rights Act of 1964 was signed into law. I&#8217;ll do a quick dive into the bill&#8217;s history and then create a map of Congress&#8217;s final vote. If you&#8217;d rather skip to the code, click one of the links below.<\/p>\n<ol>\n<li><a style=\"color: #9885bf;\" href=\"#background\">Background.<\/a><\/li>\n<li><a style=\"color: #9885bf;\" href=\"#prepare-the-data\">Prepare the data.<\/a><\/li>\n<li><a style=\"color: #9885bf;\" href=\"#plot-the-data\">Plot the data.<\/a><\/li>\n<li><a style=\"color: #9885bf;\" href=\"#the-output\">The output.<\/a><\/li>\n<\/ol>\n<hr \/>\n<h4 id=\"background\">1. Background.<\/h4>\n<p>The bill was originally proposed by President John F. Kennedy in June 1963. JFK had won the presidency with a coalition that included <a href=\"https:\/\/www.nbcnews.com\/news\/world\/remembering-kennedys-micro-targeting-1960-election-flna2d11641336\" target=\"_blank\" rel=\"noopener\">70%<\/a> of Black voters but also a majority of Southern segregationists\u2014a group deeply opposed to civil rights legislation. Kennedy spent his first two years as president triangulating on the issue. But by 1963, shifting public opinion and activism like the <em>March on Washington for Jobs and Freedom<\/em> (pictured above) made it clear to Kennedy that it was time to act. In <a href=\"https:\/\/jfk.blogs.archives.gov\/2022\/02\/01\/the-civil-rights-act-of-1964\/\" target=\"_blank\" rel=\"noopener\">an address to Congress<\/a>, he asserted that America must fight for the liberty of all citizens &#8220;above all, because it is right.&#8221; While it was still a political calculation, Kennedy had begun making a moral argument for change.<\/p>\n<figure id=\"attachment_1286\" aria-describedby=\"caption-attachment-1286\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/wollen.org\/blog\/wp-content\/uploads\/2024\/07\/jfk_oval.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-1286\" src=\"https:\/\/wollen.org\/blog\/wp-content\/uploads\/2024\/07\/jfk_oval-300x170.jpg\" alt=\"\" width=\"300\" height=\"170\" srcset=\"https:\/\/wollen.org\/blog\/wp-content\/uploads\/2024\/07\/jfk_oval-300x170.jpg 300w, https:\/\/wollen.org\/blog\/wp-content\/uploads\/2024\/07\/jfk_oval-1024x581.jpg 1024w, https:\/\/wollen.org\/blog\/wp-content\/uploads\/2024\/07\/jfk_oval-768x436.jpg 768w, https:\/\/wollen.org\/blog\/wp-content\/uploads\/2024\/07\/jfk_oval-1536x872.jpg 1536w, https:\/\/wollen.org\/blog\/wp-content\/uploads\/2024\/07\/jfk_oval.jpg 2000w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-1286\" class=\"wp-caption-text\">President Kennedy with civil rights leaders (1963).<\/figcaption><\/figure>\n<p>Kennedy made modest progress in lobbying members of Congress. However, he faced fierce pushback from others, including staunchly conservative Rep. Howard Smith (VA-08). Smith held the powerful position of House Rules Committee chairman. His position meant that he could hold the bill in committee and deny it a floor vote regardless of the bill&#8217;s overall support. And that&#8217;s exactly what he promised to do.<\/p>\n<p>Kennedy&#8217;s bill floundered in the House of Representatives for months until his assassination on November 22, 1963. But progress would accelerate from there. Vice President Lyndon B. Johnson was sworn in and he immediately made a push to pass the bill. In a joint session of Congress less than a week later, Johnson <a href=\"https:\/\/www.archives.gov\/legislative\/features\/civil-rights-1964\/lbj-address.html\" target=\"_blank\" rel=\"noopener\">proposed<\/a>:<\/p>\n<div style=\"margin-left: 10%; margin-right: 10%;\"><em>&#8220;No memorial oration or eulogy could more eloquently honor President Kennedy&#8217;s memory than the earliest possible passage of the civil rights bill for which he fought so long.&#8221;<\/em><br \/>\n\u2014<strong>President Johnson; November 27, 1963<\/strong><\/div>\n<p>LBJ was an incredibly talented legislator\u2014widely considered one of the best of the 20th century. His skill and bully pulpit were exactly what the bill would need.<\/p>\n<p>But arguably the most important factor in the bill&#8217;s passage was its popularity with voters. A <a href=\"https:\/\/news.gallup.com\/vault\/316130\/gallup-vault-americans-narrowly-1964-civil-rights-law.aspx\" target=\"_blank\" rel=\"noopener\">Gallup poll<\/a> found that 59% approved of the bill while only 31% opposed it.<\/p>\n<p>By late 1963, members of the House were circulating a discharge petition, which would have pried the bill from Rep. Smith&#8217;s hands and forced it to the floor. At long last, Smith gave in to the pressure and surrendered, and the bill passed the House on February 10, 1964.<\/p>\n<p>Of course legislating isn&#8217;t that easy. The bill went to the Senate and was then filibustered for months by Southern Democrats. President Johnson, civil rights leaders, and the public all attempted to persuade senators but no progress was made. The leader of the obstructionist group, Sen. Richard Russell of Georgia, <a href=\"http:\/\/americancenturies.mass.edu\/centapp\/oh\/story.do?shortName=nelson1939\" target=\"_blank\" rel=\"noopener\">warned<\/a>:<\/p>\n<div style=\"margin-left: 10%; margin-right: 10%;\"><em>&#8220;We will resist to the bitter end any measure or any movement which would tend to bring about social equality and intermingling and amalgamation of the races in our [Southern] states.&#8221;<\/em><br \/>\n\u2014<strong>Sen. Richard Russell<\/strong><\/div>\n<div style=\"height: 15px;\"><\/div>\n<figure id=\"attachment_1272\" aria-describedby=\"caption-attachment-1272\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/wollen.org\/blog\/wp-content\/uploads\/2024\/07\/lbj_russell.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-1272\" src=\"https:\/\/wollen.org\/blog\/wp-content\/uploads\/2024\/07\/lbj_russell-300x201.jpg\" alt=\"\" width=\"300\" height=\"201\" srcset=\"https:\/\/wollen.org\/blog\/wp-content\/uploads\/2024\/07\/lbj_russell-300x201.jpg 300w, https:\/\/wollen.org\/blog\/wp-content\/uploads\/2024\/07\/lbj_russell.jpg 600w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-1272\" class=\"wp-caption-text\">President Johnson confronts Sen. Russell.<\/figcaption><\/figure>\n<p>After four months of inaction, a pragmatic group of senators introduced a new, slightly weaker bill they believed could get enough votes (67) to overcome a filibuster. On June 19 it passed the Senate 71-29 and the Civil Rights Act of 1964 was nearly at the finish line.<\/p>\n<p>Congress formed a bicameral conference committee to reconcile small differences between House and Senate versions of the bill. Two weeks later, on July 2nd, the final bill passed both chambers and President Johnson signed it into law.<\/p>\n<figure id=\"attachment_1278\" aria-describedby=\"caption-attachment-1278\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/wollen.org\/blog\/wp-content\/uploads\/2024\/07\/lbj_signs.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-1278\" src=\"https:\/\/wollen.org\/blog\/wp-content\/uploads\/2024\/07\/lbj_signs-300x201.jpg\" alt=\"\" width=\"300\" height=\"201\" srcset=\"https:\/\/wollen.org\/blog\/wp-content\/uploads\/2024\/07\/lbj_signs-300x201.jpg 300w, https:\/\/wollen.org\/blog\/wp-content\/uploads\/2024\/07\/lbj_signs-1024x686.jpg 1024w, https:\/\/wollen.org\/blog\/wp-content\/uploads\/2024\/07\/lbj_signs-768x514.jpg 768w, https:\/\/wollen.org\/blog\/wp-content\/uploads\/2024\/07\/lbj_signs-600x400.jpg 600w, https:\/\/wollen.org\/blog\/wp-content\/uploads\/2024\/07\/lbj_signs.jpg 1280w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-1278\" class=\"wp-caption-text\">President Johnson signs the bill into law (July 2, 1964).<\/figcaption><\/figure>\n<p>The Civil Rights Act of 1964 has 11 sections, or &#8220;titles.&#8221; Most notably they address voting rights, segregation of schools, and discrimination by businesses, employers, and public institutions. Johnson <a href=\"https:\/\/www.senate.gov\/artandhistory\/history\/resources\/pdf\/JohnsonSpeechJuly21964.pdf\" target=\"_blank\" rel=\"noopener\">made the case<\/a> to the American people that equality under the law, guaranteed by the U.S. Constitution, was not being carried out in practice. The bill was necessary to ensure that we lived up to our stated ideals. It wasn&#8217;t about favoring any particular group of people. It was about correcting favoritism that unfortunately already existed.<\/p>\n<hr style=\"margin-left: 20%; margin-right: 20%;\" \/>\n<div style=\"margin-left: 10%; margin-right: 10%;\">\n<p><em>&#8220;The purpose of the law is simple. <\/em><em>It does not restrict the freedom of any American, so long as he respects the rights of others.<\/em><\/p>\n<p><em>It does not give special treatment to any citizen.<\/em><\/p>\n<p><em>It does say the only limit to a man&#8217;s hope for happiness, and for the future of his children, shall be his own ability.<\/em><\/p>\n<p><em>It does say that those who are equal before God shall now also be equal in the polling booths, in the classrooms, in the factories, and in hotels, restaurants, movie theaters, and other places that provide service to the public.<\/em><\/p>\n<p><em>I am taking steps to implement the law under my constitutional obligation to &#8216;take care that the laws are faithfully executed.'&#8221;<\/em><\/p>\n<p>\u2014<strong>President Johnson; July 2, 1964<\/strong><\/p>\n<\/div>\n<hr style=\"margin-left: 20%; margin-right: 20%;\" \/>\n<p>So what&#8217;s the point of plotting the vote? It&#8217;s a reminder that social progress isn&#8217;t done by unanimous consent. There will always be pushback.<\/p>\n<p>Most of us today can agree that the Civil Rights Act of 1964 was a good thing, but it&#8217;s easy to forget how monumental a change it was. Huge swaths of the country were violently opposed. In the following years American politics saw a fundamental realignment of the major party voting coalitions.<\/p>\n<p>Let me be clear: It isn&#8217;t my intention to demonize any area of the country or any political party. At least none in 2024. But I do believe that visualizing the vote adds useful context as we remember the bill that passed 60 years ago today.<\/p>\n<hr \/>\n<h4 id=\"prepare-the-data\">2. Prepare the data.<\/h4>\n<p>We&#8217;ll use two files to create a map of the vote:<\/p>\n<ul>\n<li>A CSV file that lists each House member&#8217;s district, political party, and vote.<\/li>\n<li>A shapefile of 1964 US congressional districts.<\/li>\n<\/ul>\n<p>Start by reading vote data into a pandas DataFrame and take a first look.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\">import pandas as pd\r\n\r\ndf = pd.read_csv(\"vote_data.csv\")\r\n\r\nprint(df.head())\r\nprint(df['party'].value_counts())\r\nprint(df['vote'].value_counts())<\/pre>\n<p>The output is below. You can see that all 432 representatives are either Democrats or Republicans. We don&#8217;t have to worry about color-coding third parties. And the final vote was 289-126 with 20 miscellaneous non-votes, which for our purposes can be treated the same.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">         state  district                                  name       party vote\r\n0     Michigan        15   Rep. John D. Dingell [D, 1955-1964]    Democrat  Yea\r\n1   California        29   Rep. George E. Brown [D, 1963-1970]    Democrat  Yea\r\n2     Virginia         4    Rep. Watkins Abbitt [D, 1947-1972]    Democrat  Nay\r\n3         Ohio        10       Rep. Homer Abele [R, 1963-1964]  Republican  Yea\r\n4  Mississippi         1  Rep. Thomas Abernethy [D, 1953-1972]    Democrat  Nay\r\n\r\nparty\r\nDemocrat 254\r\nRepublican 178\r\nName: count, dtype: int64\r\n\r\nvote\r\nYea 289\r\nNay 126\r\nNot Voting 12\r\nPresent 4\r\nVacant 3\r\nSpeaker 1\r\nName: count, dtype: int64<\/pre>\n<p>My plan is to color each legislative district based on party and vote. We have two categories, each with two possible values (ignoring the 20 non-votes), so we&#8217;ll need four colors:<\/p>\n<ul>\n<li>Democrat | Yes \u2014 #0044C9<\/li>\n<li>Democrat | No \u2014 #B1B1FF<\/li>\n<li>Republican | Yes \u2014 #E81B23<\/li>\n<li>Republican | No \u2014 #FF9999<\/li>\n<\/ul>\n<p>I think it makes sense to use the modern red\/blue color scheme even though it wasn&#8217;t yet in use 60 years ago. It should help viewers to quickly understand what&#8217;s being communicated. I&#8217;ll use brighter, more saturated colors for Yes votes and muted pastels for No.<\/p>\n<p>Create a new column to hold color data. Later we&#8217;ll pass it as an argument to the <code>plot<\/code> method.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\">def get_color(row):\r\n    vote_type = (row['party'], row['vote'])\r\n\r\n    color_dict = {(\"Democrat\", \"Yea\"): \"#0044C9\",\r\n                  (\"Democrat\", \"Nay\"): \"#B1B1FF\",\r\n                  (\"Republican\", \"Yea\"): \"#E81B23\",\r\n                  (\"Republican\", \"Nay\"): \"#FF9999\"}\r\n\r\n    if vote_type in color_dict:\r\n        return color_dict[vote_type]\r\n    else:\r\n        return \"#F7F7CC\"\r\n\r\n\r\ndf.loc[:, 'color'] = df.apply(get_color, axis=1)<\/pre>\n<p>This DataFrame will be combined with a shapefile GeoDataFrame. We&#8217;ll need an identical column in both that can be used to match rows. Both files have state and district number columns so let&#8217;s concatenate them and call it <em>district_id<\/em>.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\">df.loc[:, 'district_id'] = df['state'] + df['district'].astype(str)<\/pre>\n<p>Read the shapefile into a GeoDataFrame and create a corresponding <em>district_id<\/em> column. The geopandas code is essentially the same.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\">import geopandas as gpd\r\n\r\ngdf = gpd.read_file(\"shapefile\/districts088.shp\", epsg=4326)\r\n\r\ngdf.loc[:, 'district_id'] = gdf['STATENAME'] + gdf['DISTRICT'].astype(str)<\/pre>\n<p>Now we can join the data. Call <code>merge<\/code> on <code>gdf<\/code> and reassign the result back to <code>gdf<\/code>. Specify that <em>district_id<\/em> is the column in common.<\/p>\n<p>If you check the number of columns you&#8217;ll find that <code>df<\/code> has 7, <code>gdf<\/code> has 17, and the resulting merged <code>gdf<\/code> has 23. That means our operation worked correctly.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\">gdf = gdf.merge(df, on=\"district_id\")<\/pre>\n<hr \/>\n<h4 id=\"plot-the-data\">3. Plot the data.<\/h4>\n<p>Now we can map the data using Matplotlib. I&#8217;ll use a custom <em>mplstyle<\/em> to help cut down on repeated code. It will be linked at the bottom of this post.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\">from mpl_toolkits.axes_grid1.inset_locator import zoomed_inset_axes\r\nfrom matplotlib.patches import Rectangle\r\n\r\nplt.style.use(\"civil_rights_act.mplstyle\")\r\n\r\nfig, ax = plt.subplots()<\/pre>\n<p>Both pandas and geopandas make it easy to plot dataframes. Call the <code>plot()<\/code> method and specify on which axes object it should be drawn.<\/p>\n<p><code>categorical=True<\/code> tells geopandas that we&#8217;re plotting categories rather than numerical data. We have five discrete categories (e.g. Democrat | Yes) and we don&#8217;t need a continuous color gradient. We&#8217;ll specify our own colors by passing the <em>color<\/em> column. <code>edgecolor<\/code> and <code>linewidth<\/code> define borders between congressional districts.<\/p>\n<p>x-limits and y-limits are in units of longitude and latitude, respectively.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\">gdf.plot(ax=ax, categorical=True, color=gdf['color'], edgecolor=\"black\", linewidth=0.2)\r\n\r\nax.set_xlim(-125.1, -66.6)\r\nax.set_ylim(24.4, 49.5)<\/pre>\n<p>Next add insets for Alaska and Hawaii. Create a view of <code>gdf<\/code> containing only the state&#8217;s data and an axes object on which to draw it.<\/p>\n<p>x and y limits are expressed as longitude and latitude, just like above, but <code>bbox<\/code> coordinates range from 0 to 1 across the parent axes.<\/p>\n<p>It takes a few lines of code to add inset axes but it&#8217;s essentially the same process as before.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\">gdf_alaska = gdf[gdf['state'] == \"Alaska\"]\r\nax_alaska = zoomed_inset_axes(ax, zoom=0.3, bbox_to_anchor=(0.25, 0.29), bbox_transform=plt.gcf().transFigure)\r\ngdf_alaska.plot(ax=ax_alaska, categorical=True, color=gdf_alaska['color'], edgecolor=\"black\", linewidth=0.2)\r\nax_alaska.set_xlim(-172.5, -128)\r\nax_alaska.set_ylim(52, 73)\r\n\r\ngdf_hawaii = gdf[gdf['state'] == \"Hawaii\"]\r\nax_hawaii = zoomed_inset_axes(ax, zoom=1.0, bbox_to_anchor=(0.35, 0.22), bbox_transform=plt.gcf().transFigure)\r\ngdf_hawaii.plot(ax=ax_hawaii, categorical=True, color=gdf_hawaii['color'], edgecolor=\"black\", linewidth=0.2)\r\nax_hawaii.set_xlim(-160.5, -154.5)\r\nax_hawaii.set_ylim(18.5, 22.5)<\/pre>\n<p>Next up is a legend, which I&#8217;d like to create manually using Matplotlib&#8217;s <code>Rectangle<\/code> patch.<\/p>\n<p>A <code>for<\/code> loop helps to avoid repeated code. Organize legend handles and colors into a list of tuples and iterate through them.<\/p>\n<p>We&#8217;re once again working on the main axes object so normal rules of latitude and longitude apply. Alaska and Hawaii are located in the lower-left corner so let&#8217;s draw the legend somewhere in the Atlantic Ocean.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\">legend_info = [(\"R Yes  (136)\", \"#E81B23\"),\r\n               (\"R No  (35)\", \"#FF9999\"),\r\n               (\"D Yes  (153)\", \"#0044C9\"),\r\n               (\"D No  (91)\", \"#B1B1FF\"),\r\n               (\"N\/A  (20)\", \"#F7F7CC\")]\r\ny_pos = 31\r\nfor item in legend_info:\r\n    ax.add_patch(Rectangle((-75.5, y_pos), 1.5, 1, facecolor=item[1]))\r\n    ax.text(-73.5, y_pos + 0.5, item[0], ha=\"left\", va=\"center\")\r\n    y_pos -= 1<\/pre>\n<p>Also make a note of the final vote tally using <code>text<\/code>. This can go north of the legend.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\">ax.text(-71, 37.0, \"289 - 126\", size=14, ha=\"center\", va=\"bottom\")\r\nax.text(-71, 36.8, \"Pass\", ha=\"center\", va=\"top\")\r\n<\/pre>\n<p>Finally, set a title, turn off axis clutter, and save the figure. The shapefile has a lot of fine detail so I would suggest using a relatively high <code>dpi<\/code>. Or you could save as an SVG.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\">ax.text(-77.5, 48.0, \"Civil Rights Act of 1964\", size=16, ha=\"center\", va=\"center\")\r\nax.text(-77.5, 47.2, \"House of Representatives\", size=14, ha=\"center\", va=\"center\")\r\nax.text(-77.5, 46.4, \"July 2, 1964\", size=14, ha=\"center\", va=\"center\")\r\n\r\nax.set_axis_off()\r\nax_alaska.set_axis_off()\r\nax_hawaii.set_axis_off()\r\n\r\nplt.savefig(\"civil_rights_act.png\", dpi=300)<\/pre>\n<hr \/>\n<h4 id=\"the-output\">4. The output.<\/h4>\n<p><a href=\"https:\/\/wollen.org\/blog\/wp-content\/uploads\/2024\/07\/civil_rights_act.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1726 size-full\" src=\"https:\/\/wollen.org\/blog\/wp-content\/uploads\/2024\/07\/civil_rights_act.png\" alt=\"\" width=\"4200\" height=\"2550\" srcset=\"https:\/\/wollen.org\/blog\/wp-content\/uploads\/2024\/07\/civil_rights_act.png 4200w, https:\/\/wollen.org\/blog\/wp-content\/uploads\/2024\/07\/civil_rights_act-300x182.png 300w, https:\/\/wollen.org\/blog\/wp-content\/uploads\/2024\/07\/civil_rights_act-1024x622.png 1024w, https:\/\/wollen.org\/blog\/wp-content\/uploads\/2024\/07\/civil_rights_act-768x466.png 768w, https:\/\/wollen.org\/blog\/wp-content\/uploads\/2024\/07\/civil_rights_act-1536x933.png 1536w, https:\/\/wollen.org\/blog\/wp-content\/uploads\/2024\/07\/civil_rights_act-2048x1243.png 2048w\" sizes=\"auto, (max-width: 4200px) 100vw, 4200px\" \/><\/a><\/p>\n<p>The map confirms what we already knew: most of the bill&#8217;s opposition came from the South.<\/p>\n<p>But there were exceptions all over the country. Southern Democrats from more urban districts surrounding San Antonio, Houston, Nashville, Atlanta, and Miami voted Yes. Some northern rural Republicans voted No.<\/p>\n<p>As I said above, the lack of unanimity is the point. Even very good ideas face pushback. The important thing is to recognize when it&#8217;s worth making a stand.<\/p>\n<hr \/>\n<p><a href=\"https:\/\/wollen.org\/misc\/civil_rights_act_2024.zip\"><strong>Download the data.<\/strong><\/a><\/p>\n<p><a href=\"https:\/\/cdmaps.polisci.ucla.edu\/\" target=\"_blank\" rel=\"noopener\"><strong>Download congressional district shapefiles (ucla.edu).<\/strong><\/a><\/p>\n<p><a href=\"https:\/\/www.govtrack.us\/congress\/votes\/88-1964\/h182\" target=\"_blank\" rel=\"noopener\"><strong>Vote info (govtrack.us).<\/strong><\/a><\/p>\n<p><strong>Full code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\">import pandas as pd\r\nimport geopandas as gpd\r\nimport matplotlib.pyplot as plt\r\nfrom mpl_toolkits.axes_grid1.inset_locator import zoomed_inset_axes\r\nfrom matplotlib.patches import Rectangle\r\n\r\n\r\ndef get_color(row):\r\n    vote_type = (row['party'], row['vote'])\r\n\r\n    color_dict = {(\"Democrat\", \"Yea\"): \"#0044C9\",\r\n                  (\"Democrat\", \"Nay\"): \"#B1B1FF\",\r\n                  (\"Republican\", \"Yea\"): \"#E81B23\",\r\n                  (\"Republican\", \"Nay\"): \"#FF9999\"}\r\n\r\n    if vote_type in color_dict:\r\n        return color_dict[vote_type]\r\n    else:\r\n        return \"#F7F7CC\"\r\n\r\n\r\ndf = pd.read_csv(\"vote_data.csv\")\r\ndf.loc[:, 'color'] = df.apply(get_color, axis=1)\r\ndf.loc[:, 'district_id'] = df['state'] + df['district'].astype(str)\r\n\r\ngdf = gpd.read_file(\"shapefile\/districts088.shp\", epsg=4326)\r\ngdf.loc[:, 'district_id'] = gdf['STATENAME'] + gdf['DISTRICT'].astype(str)\r\n\r\ngdf = gdf.merge(df, on=\"district_id\")\r\n\r\nplt.style.use(\"civil_rights_act.mplstyle\")\r\nfig, ax = plt.subplots()\r\n\r\ngdf.plot(ax=ax, categorical=True, color=gdf['color'], edgecolor=\"black\", linewidth=0.2)\r\n\r\nax.set_xlim(-125.1, -66.6)\r\nax.set_ylim(24.4, 49.5)\r\n\r\ngdf_alaska = gdf[gdf['state'] == \"Alaska\"]\r\nax_alaska = zoomed_inset_axes(ax, zoom=0.3, bbox_to_anchor=(0.25, 0.29), bbox_transform=plt.gcf().transFigure)\r\ngdf_alaska.plot(ax=ax_alaska, categorical=True, color=gdf_alaska['color'], edgecolor=\"black\", linewidth=0.2)\r\nax_alaska.set_xlim(-172.5, -128)\r\nax_alaska.set_ylim(52, 73)\r\n\r\ngdf_hawaii = gdf[gdf['state'] == \"Hawaii\"]\r\nax_hawaii = zoomed_inset_axes(ax, zoom=1.0, bbox_to_anchor=(0.35, 0.22), bbox_transform=plt.gcf().transFigure)\r\ngdf_hawaii.plot(ax=ax_hawaii, categorical=True, color=gdf_hawaii['color'], edgecolor=\"black\", linewidth=0.2)\r\nax_hawaii.set_xlim(-160.5, -154.5)\r\nax_hawaii.set_ylim(18.5, 22.5)\r\n\r\nlegend_info = [(\"R Yes  (136)\", \"#E81B23\"),\r\n               (\"R No  (35)\", \"#FF9999\"),\r\n               (\"D Yes  (153)\", \"#0044C9\"),\r\n               (\"D No  (91)\", \"#B1B1FF\"),\r\n               (\"N\/A  (20)\", \"#F7F7CC\")]\r\ny_pos = 31\r\nfor item in legend_info:\r\n    ax.add_patch(Rectangle((-75.5, y_pos), 1.5, 1, facecolor=item[1]))\r\n    ax.text(-73.5, y_pos + 0.5, item[0], ha=\"left\", va=\"center\")\r\n    y_pos -= 1\r\n\r\nax.text(-71, 37.0, \"289 - 126\", size=14, ha=\"center\", va=\"bottom\")\r\nax.text(-71, 36.8, \"Pass\", ha=\"center\", va=\"top\")\r\n\r\nax.text(-77.5, 48.0, \"Civil Rights Act of 1964\", size=16, ha=\"center\", va=\"center\")\r\nax.text(-77.5, 47.2, \"House of Representatives\", size=14, ha=\"center\", va=\"center\")\r\nax.text(-77.5, 46.4, \"July 2, 1964\", size=14, ha=\"center\", va=\"center\")\r\n\r\nax.set_axis_off()\r\nax_alaska.set_axis_off()\r\nax_hawaii.set_axis_off()\r\n\r\nplt.savefig(\"civil_rights_act.png\", dpi=300)<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Today marks 60 years since the Civil Rights Act of 1964 was signed into law. I&#8217;ll do a quick dive into the bill&#8217;s history and then create a map of Congress&#8217;s final vote. If you&#8217;d rather skip to the code,<\/p>\n","protected":false},"author":1,"featured_media":1263,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19,238,68],"tags":[293,290,292,267,283,291,91,278,22,189,185,282,21,173,92,280,285,288,287,72,284,73,271,289,24,286,126,30,281,46,187,25,190,93,71,294,87],"class_list":["post-1259","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-maps","category-government","category-history","tag-293","tag-290","tag-anniversary","tag-annotate","tag-civil-rights","tag-civil-rights-act-of-1964","tag-congress","tag-coordinates","tag-data","tag-democrat","tag-election","tag-epsg","tag-geopandas","tag-graph","tag-house-of-representatives","tag-inset_axes","tag-jfk","tag-johnson","tag-kennedy","tag-latitude","tag-lbj","tag-longitude","tag-map","tag-martin-luther-king","tag-matplotlib","tag-mlk-jr","tag-mplstyle","tag-pandas","tag-patch","tag-plot","tag-politics","tag-python","tag-republican","tag-senate","tag-shapefile","tag-vote","tag-zoomed_inset_axes"],"_links":{"self":[{"href":"https:\/\/wollen.org\/blog\/wp-json\/wp\/v2\/posts\/1259","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wollen.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wollen.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wollen.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wollen.org\/blog\/wp-json\/wp\/v2\/comments?post=1259"}],"version-history":[{"count":70,"href":"https:\/\/wollen.org\/blog\/wp-json\/wp\/v2\/posts\/1259\/revisions"}],"predecessor-version":[{"id":1999,"href":"https:\/\/wollen.org\/blog\/wp-json\/wp\/v2\/posts\/1259\/revisions\/1999"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wollen.org\/blog\/wp-json\/wp\/v2\/media\/1263"}],"wp:attachment":[{"href":"https:\/\/wollen.org\/blog\/wp-json\/wp\/v2\/media?parent=1259"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wollen.org\/blog\/wp-json\/wp\/v2\/categories?post=1259"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wollen.org\/blog\/wp-json\/wp\/v2\/tags?post=1259"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}