Skip to content

Instantly share code, notes, and snippets.

@mollietaylor
Created September 7, 2012 22:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mollietaylor/3670315 to your computer and use it in GitHub Desktop.
Save mollietaylor/3670315 to your computer and use it in GitHub Desktop.
Map of prominent patent sectors of 50 largest U.S. cities in R
csacode Latitude Longitude cityshort city largestsector secnum
160 42.904722 -78.849444 Buffalo Buffalo-Niagara-Cattaraugus, NY CSA Chemical 1
172 35.226944 -80.843333 Charlotte Charlotte-Gastonia-Salisbury, NC-SC CSA Chemical 1
178 39.133333 -84.5 Cincinnati Cincinnati-Middletown-Wilmington, OH-KY-IN CSA Chemical 1
184 41.482222 -81.669722 Cleveland Cleveland-Akron-Elyria, OH CSA Chemical 1
198 39.983333 -82.983333 Columbus Columbus-Marion-Chillicothe, OH CSA Chemical 1
288 29.762778 -95.383056 Houston Houston-Baytown-Huntsville, TX CSA Chemical 1
350 38.25 -85.766667 Louisville Louisville/Jefferson County_Elizabethtown_Scottsburg, KY-IN CSA Chemical 1
408 40.664167 -73.938611 New York New York-Newark-Bridgeport, NY-NJ-CT-PA CSA Chemical 1
428 39.95 -75.17 Philadelphia Philadelphia-Camden-Vineland, PA-NJ-DE-MD CSA Chemical 1
430 40.441667 -80 Pittsburgh Pittsburgh-New Castle, PA CSA Chemical 1
476 38.627222 -90.197778 St. Louis St. Louis-St. Charles-Farmington, MO-IL CSA Chemical 1
27260 30.3194 -81.66 Jacksonville Jacksonville, FL MSA Chemical 1
40060 37.540972 -77.432889 Richmond Richmond, VA MSA Chemical 1
122 33.755 -84.39 Atlanta Atlanta-Sandy Springs-Gainesville, GA-AL CSA Computers and Communications 2
148 42.357778 -71.061667 Boston Boston-Worcester-Manchester, MA-RI-NH CSA Computers and Communications 2
206 32.782778 -96.803889 Dallas Dallas-Fort Worth, TX CSA Computers and Communications 2
216 39.739167 -104.984722 Denver Denver-Aurora-Boulder, CO CSA Computers and Communications 2
312 39.1 -94.58 Kansas City Kansas City-Overland Park-Kansas City, MO-KS CSA Computers and Communications 2
450 35.818889 -78.644722 Raleigh Raleigh-Durham-Cary, NC CSA Computers and Communications 2
472 38.555556 -121.468889 Sacramento Sacramento_Arden Arcade_Yuba City, CA-NV CSA Computers and Communications 2
488 37.335278 -121.891944 San Jose San Jose-San Francisco-Oakland, CA CSA Computers and Communications 2
500 47.609722 -122.333056 Seattle Seattle-Tacoma-Olympia, WA CSA Computers and Communications 2
548 38.886758 -77.041625 Washington Washington-Baltimore-Northern Virginia, DC-MD-VA-WV CSA Computers and Communications 2
33100 25.787676 -80.224145 Miami Miami_Fort Lauderdale_Pompano Beach, FL MSA Computers and Communications 2
38900 45.52 -122.681944 Portland Portland_Vancouver_Hillsboro, OR_WA MSA Computers and Communications 2
378 44.983333 -93.266667 Minneapolis Minneapolis-St. Paul-St. Cloud, MN-WI CSA Drugs and Medical 3
32820 35.117365 -89.971068 Memphis Memphis, TN-MS-AR MSA Drugs and Medical 3
41700 29.416667 -98.5 San Antonio San Antonio_New Braunfels, TX MSA Drugs and Medical 3
41740 32.715 -117.1625 San Diego San Diego_Carlsbad_San Marcos, CA MSA Drugs and Medical 3
104 42.652594 -73.757314 Albany Albany-Schenectady-Amsterdam, NY CSA Electrical and Electronic 4
126 30.25 -97.75 Austin Austin-Round Rock-Marble Falls, TX CSA Electrical and Electronic 4
268 36.08 -79.819444 Greensboro Greensboro_Winston-Salem_High Point, NC CSA Electrical and Electronic 4
278 41.762736 -72.674286 Hartford Hartford-West Hartford-Willimantic, CT CSA Electrical and Electronic 4
348 34.05 -118.25 Los Angeles Los Angeles-Long Beach-Riverside, CA CSA Electrical and Electronic 4
376 43.05 -87.95 Milwaukee Milwaukee-Racine-Waukesha, WI CSA Electrical and Electronic 4
422 28.415833 -81.298889 Orlando Orlando-Deltona-Daytona Beach, FL CSA Electrical and Electronic 4
38060 33.4482 -112.0738 Phoenix Phoenix_Mesa_Glendale, AZ MSA Electrical and Electronic 4
142 33.524755 -86.81274 Birmingham Birmingham-Hoover-Cullman, AL CSA Mechanical 5
176 41.881944 -87.627778 Chicago Chicago-Naperville-Michigan City, IL-IN-WI CSA Mechanical 5
220 42.331389 -83.045833 Detroit Detroit-Warren-Flint, MI CSA Mechanical 5
266 42.96125 -85.655719 Grand Rapids Grand Rapids-Muskegon-Holland, MI CSA Mechanical 5
273 34.844444 -82.385556 Greenville Greenville-Spartanburg-Anderson, SC CSA Mechanical 5
294 39.791 -86.148 Indianapolis Indianapolis-Anderson-Columbus, IN CSA Mechanical 5
332 36.175 -115.136389 Las Vegas Las Vegas-Paradise-Pahrump, NV CSA Mechanical 5
400 36.166667 -86.783333 Nashville Nashville-Davidson_Murfreesboro_Columbia, TN CSA Mechanical 5
406 29.966667 -90.05 New Orleans New Orleans-Metairie-Bogalusa, LA CSA Mechanical 5
416 35.4823 -97.5352 Oklahoma City Oklahoma City-Shawnee, OK CSA Mechanical 5
482 40.75 -111.883333 Salt Lake City Salt Lake City-Ogden-Clearfield, UT CSA Mechanical 5
45300 27.970898 -82.46464 Tampa Tampa-St. Petersburg-Clearwater, FL MSA Mechanical 5
47260 36.8506 -75.9779 Virginia Beach Virginia Beach-Norfolk-Newport News, VA-NC MSA Mechanical 5
sectors <- read.table("sectors.csv", header=TRUE, sep=",")
library(maps)
library(RColorBrewer)
library(classInt)
names(sectors)
plotvar <- sectors$secnum #change this line to change data
plotclr <- brewer.pal(5,"Set1")
class <- classIntervals(plotvar, 5, 'pretty')#or pretty
colcode <- findColours(class, plotclr)
map("state", ylim=range(50, 22), col=8)
points(sectors$Longitude, sectors$Latitude, pch=16, col=colcode, cex=1.5)
points(sectors$Longitude, sectors$Latitude, cex=1.5, col="gray50") #makes outlines for dots
legend(-125.8, 30, legend=c('Chemical','Computers and Communications','Drugs and Medical','Electrical and Electronic','Mechanical'), fill=attr(colcode, "palette"), cex=0.6, bty="n")
text(sectors$Longitude, sectors$Latitude, sectors$cityshort, pos=1, cex=0.4)
# dev.copy(pdf,'sectors.pdf')
# dev.off()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment