Making Pretty Pictures with ggplot2 Drew Conway December 3, 2009 - - PowerPoint PPT Presentation
Making Pretty Pictures with ggplot2 Drew Conway December 3, 2009 - - PowerPoint PPT Presentation
Making Pretty Pictures with ggplot2 Drew Conway December 3, 2009 Types of Plots Well Cover Scatter Plots Identifying key actors in #rstats network Tipping: Women vs. Men Time-Series Closing Price of Four Major European Stock
Types of Plots We’ll Cover
Scatter Plots
◮ Identifying key actors in #rstats network ◮ Tipping: Women vs. Men
Time-Series
◮ Closing Price of Four Major European Stock Indices 1991-1998 ◮ Effect of Seatbelt Law on Automobile Fatalities in UK
Other Examples and Online Resources
◮ Learning R Blog ◮ Hadley’s Resources ◮ REvolution Computing Blog
Introduction Scatter Plots Time Series Plots Other Examples and Online Resources Key Actor Analysis Tipping by Sex
Identifying key actors in #rstats network
Last month I presented the SNA in R talk to the Bay Area R Meetup
◮ As part of this presentation I generated the online social network of people
- n Twitter discussing R by mining the #rstats hash-tag
◮ As before, I used ggplot2 to generate a plot that highlights key actors in
the network
> # Load ggplot2 library > library(ggplot2) > # Load in centrality data > rstats.cent<-read.csv("rstats_centrality.csv") > # Calculate residuals for simple OLS of eig~bet > rstats.res<-as.vector(lm(eig~bet,data=rstats.cent)$residuals) > rstats.cent<-transform(rstats.cent,res=rstats.res) > # Create plot > cent.plot<-ggplot(rstats.cent,aes(x=bet,y=eig,label=name,colour=res, + size=abs(res)))+xlab("Betweenness Centrality")+ylab("Eigenvector + Centrality") > cent.plot<-cent.plot+geom_text()+opts(title="Key Actor Analysis for #rstats")
Drew Conway Making Pretty Pictures with ggplot2
Introduction Scatter Plots Time Series Plots Other Examples and Online Resources Key Actor Analysis Tipping by Sex
Key Actor Plot of #rstats Social Network
This plot will look familiar to those that attended my SNA in R talk in August!
Key Actor Analysis for #rstats
Betweenness Centrality Eigenvector Centrality
0.0 0.2 0.4 0.6 0.8 1.0
CMastication
ChrisAlbon
math_geek GetStatWise rhh TeachersView MortForestry emmbeehey deepfoo JerryWeinberg MapBox praglife
dondodge
innomgmt jonathanstark finance_book pourmecoffee Ribbit Periscopic pjkarlik easyemini mmanti jobsworth
bshor
esh
republicofmath
TomBodett TheBloggess samj iankoenig ShlomoSwidler thinkgeek geekstats InteractiveGIS thegisforum briantimoney zzztimbo Dan_Tattersall nils_gehlenborg defrag michaelmilton
finiteattention
jcheng sodapopgang creditsms
nbarrowman
eAPStylebook
ebertchicago elaineinspired
hmason
lemire
jeromyanglim
andrewrsorkin carney
nntaleb
attilacsordas felipexgonzalez
marcoscan
vishalbelsare
gwenshap learnemacs dmdu
- grisel
nikkigraziano kirkwy
rpietro
amarkos
DrewFromTV fireland
make jboner statmaven MicroCapital karlijnmorsink NISSSAMSI plantdisease howtoprojects
- vertfascist
ronlieber ddemeyer
swissmiss
OurOpenbank toddjsch howtogeek
infochimps Rfortunes
lessin
seth
albertwenger jobinluxembourg SamQC badbanana
PhilRack
johngarvie
s_m_conway
alea_ jpmarcum colinr23
videolectures
Ghaffary
helenlundgreen Web_Neuronal BlackBerry BlackBerryDev demiwood BridgetAyers victoriakaria HelpMeRick ModelSupplies Gemstars CJHeart madlyv Chris_Gorham YankeeGirl20 GuyKawasaki BenParr kim ShellyKramer TrendTracker drew 8KA ashsmashtrash mashable Pam_atFangtasia FangtasiaGinger SookieBonTemps ev BarackObama NYTimeskrugman Twitter_Tips jack tdgch academicdave Alyssa_Milano gpalestine LaraABCNews
NazilaVali AnahitaPur maryaria FaryadeSokoot
- bservateurs
Anahiid danailon
tarantulae
geochirping silvioporcellan nuok infosthetics fluido dreamgrow folderburg twanslate VirginiaMiracle roweenaweb mrkris CollaborativeTM MarkONeill djangocms hubmilan antirez leeander digitalizes YWebAnalytics immeria
wefollow
semarena Gist chinafiles codiciSconti MobileMktrDaily chr1sa
timoreilly
Mashape the_tweet_spot TwitItalia tomsanalytics antefatto Involucra veke87 Hansro icrossing stpeter hfarmventures CampaignMonitor Marband Feba spinozait mattial petecocoon
revodavid
sfalcon imusicmash ecpolley ChrisDyer
peteskomoroch
earlycj5
kenny_shen NPHard josecamoessilva
pkedrosky
brendan642
hadleywickham
ikongsgf
drewconway
leoniedu
greghirson
daniel_levine
ddmeyer
JohnDCook
ColinMagee
rstatsmob
zeitzoff
randomjohn
QuaSSI
REvoComp
kinggary
DataJunkie
dmgerbino
gappy3000
statpumpkin
jakehofman
SaraD smocarski nbrgraphs
nikete
- nertipaday
Quesada
liebke
geirmagnusson jandersen communityone mfauscette
i2pi
bocowgill eleanorahowe znmeb mjasay mwexler
dataspora
herrold
REvolutionR
GavinNewsom
flowingdata
kdnuggets
DivaDanese
twitter cnnbrk
- sakanayasan
hashtags
codinghorror
joshk TCtrends gaberivera papayamaya InternMatch auralab stevegillmor danasittler cristinacordova Altons Rarchive LuisChataing LoveStats degrafa sasCommunity planetJudo lammiia codeZenGuru csimien kevinanalytics cjdinger stefaniegreay hcsbi
peterflom
sasbi NelsonBocaranda javoha shawnafennell francescomugnai reisterm elgranguru alisonbolen LainieH SACAMBRO DataMiningBlog sastips annmariastat StaceyHamilton swaynette sgoodin Novato vsardi Vero_puente whoison
- rvtech
cwcity SASJedi tufotosurfeando Talent_Feed bensweeting
gregclimbs
kevinDwhite jeffkerkove aliengin adammyerson ANTPlus markrages topquarq quarq lozy kegerators GoGoGoulet Chase196126 RockArtBrewery Photo_John MITAerobike AaronJacobTrent Whareagle TOURoftheGILA EpicBrewing revbiggerring DarbyRides MetriGear VholdR cyclocross mikefriedman2 3point5 Zipp_USA veldrijdeninfo bikesnobnyc TUAW Bike_Tweetup hollyblanco SimonBurney mikezagorski johnswah mrmalty Pleepleus azirneklis SRM_Daniel Michael_Creed KatieFnCompton CharliePapazian fatcyclist Themopinator GeekCyclist SaintArnold Storman1 CrossVegas
- yamansan
theTourofUtah hage microsofthohm MMP_Utah Peddlingsquares madsencycles chriscleeland lisak1006 jaredeborn brewingnetwork kelouder OriJenel newageathlete utahCritSeries neilkod2 BlackbottomsCEO blackbottoms CrossDoctor Terencepeak DaveHarward RevBigRing HomeBrewTalk slctbird louderjeff CoachTMac bradfordleo ktgasser dzabriskie taylorphinney CycleOpsPower sufferfest BryanCX Liz_Hatch MarkEWERS mudandcowbells crosssports hairball_dh timetrial canmoremd xtracycle colinmhart tcornes drda mxmissile ThePrivateer flahute GrizzlyAdam
neilkod
mja
PrancingPapio primatology DavePollard andreazammit aufrank tweetie strongspace brianglanz mcvmcv RAUSCHofficial Fumi
benm
mikrhmelody wanderfowl DrDasha brynn aufaux
hamiltonulmer
LilyCopple
kenreisman
kaythaney hannahrudman
awadallah
grazing_gazelle kathadams qikipedia
jeffreyhorner
lightscalar Postbox avdorita npe9 doocot Silona datamapper
hackingdata
hadoop SignalPatterns kimmieoftroy DoloresLabs dhruvbansal
yfd
mrflip
jesspalmer gtcaz PLoS kelixo jichikawa Sainsha arthegall gotgenes mza mekentosj patsycat21 girlscientist sophietwins mamash george_l NextBio stephenfry zengjinyan BreakingNews rtm doingtext PhilGeek followben AKMA timhwang freesci dianakimball
mdreid
tkunau moorejh PeroMHC marissaneave christopheradam janl delagoya luke0x expandrive butterlabel topfunky mitten jacques Joi monpage genjokoan joeld philipj NicMcPhee logista joyeurs
floleibert poliscipunk bwaber
berndweiss
dpatil kremplo eraquest APSAtweets allthingsct VelvetCigars Jay_Fraser BaghdadBrian dhsscitech danielequercia danevans87
ansate
EVillageTav lbcolin17
dggoldst
joshuafoust jmonogan
vsbuffalo
ArmedwScience GartensteinRoss NetSciWestPoint AfPakChannel heatherlib plotti ArmedConflict fonnesbeck lucasjosh ForeignAffairs_ e_IR kwcollins graykimbrough
wahalulu
geoffjentry
mikewhills johnnyryan ubiwar ICSRblog
nicoleradziwill
isanet whatagirl dhnexon moranned NationalDefense aerogan brfry ittagroB TheEconomist BillPetti baldown mountainrunner
juegologo
kmcurry kmallwein KevinBossman LindseyCormack alanna_shaikh Tosk59
mmparker
jocemiller AshaJPC fpenkala Amierah Thurayia mavgi davidsteven hueythewookiee jensonsdaniel eyewitnessnyc ckras anna1021 gutelius sgourley MB2MB cjschaefer TCaseyArend packetsink ianpcook markwbaur evgenymorozov phosphor_m
y_benjo ikakura7188 wakuteka takeshou gomamint nozma syou6162 dritoshi St_01 kane_suke team_84 dedede11 h_okumura tarot3 willcom_blog OLIOSPEC jsiaky hidamarixx publog twobile eagletail satoo3100 dot_h2o mykakuteru imorokun iDES SansMouse McHighpants bhinchliffe fb_interface sds3000 TEDActive dpaterl AlightPlanning ncmarques demis
neil_conway
AFIDCL sallex inowland gamearchitect Scimark AndrewNYC Jeffely Jurate Woodshedder wormphlegm shirleybrady
TechCrunch
semanticvoid
zhuyo voyce tweenky NakedTrader valkenburgh TwitZap noreenahertz ericmeade asvinb ETFexpert abubious ETFtrends
thatwhichmatter
igorcarron
timwee
DTN_ProphetX MarketsWiki DTN_IQFeed cartazio David_Evans1 ttshin EconOfContempt FinReg21 roolio
eliast
AFG85 edumaster d_starr grammarware scottblanc
jasonmorton
jayruy diefenbach Ehva evanmeagher
EllieSemantic
abnormalreturns neuralmarket weirdralph EconTalker scsibug
TheOnion
ETFexplorer interfluidity alexbunardzic ETFdb kaiwei ThinkingFinance mesimos
ealdent
zefrank yokofakun LucAllemand AlineRichard maglarecherche billroberts CompleteGenomic humangenomeorg Kreli4n cshperspectives ldodds timjph agulmann jcorkery timberners_lee benosteen timrobertson100 toraks lesleyanson sangerinstitute Jim_Croft julie_letierce nanopore derivadow dgmacarthur NatureNews jatorre myncbi ncbi_pubmed reactome Happybene peetucket samiahurst Yvic Fuzzyraptor NicolasLoubet NatureRevGenet io2a diybio shelleypowers DublinCore KatherineMejia Theo_Bloom emeyke genomeresearch jermth
walshtp
digitalurban eoflife dbkell Etche_homo realmarcin therealBuzz Astro_127 TEDchris phdcomics mysql ChemSpiderman RichardDawkins ynancy jahendler Scopus GoogleCode javatools naturebiotech BioMedCentral tomroud kehan M_le_prof Darwin2009 ApolloPlus40 brembs faonews sciencesetdemoc SebastienDupre OldCola elifsulavraie scottmccloud PenelopeB eqds McDawg michael_nielsen amatern bgood pgpeople vloux modernscientist davidjstudholme jeargle kshameer nicoadams simon_t DroolsRules tisimpson xproc 454Sequencing tpoi Enroweb mpastell Ehkeskus
annabraham
GTDSpecialEvent razZ0r
datavis
malikammour mindbudget mrgunn feedly spam chartoftheday kiwitobes
ben_fry
shwu
lessig
d_swan sycophante scienceamusante Nanostelia neuromancien pierreyves eeaster deuxieme_labo millerdl neilswainston wave_watch localparis ClimbingAction productivity501 daveseah
myen
alark benjaminferran
jmstat
mmarchin mvenet DJurczak Julien89 rgaidot jamiemcquay RNieuwenhuis rorywinston mixero doctorow sjcockell marcoscarvalho capap nk_m tlemberger fjossinet resolverone sylvaingolenia aviers vincentglad ecrans
- penprocessing
tferriss
- rangatame
resolversystems gtdguy byzia myGeneticist jhabig gregaustin1 Phocion gpjt tomtubbs tableau rvidal jdudley
- mnee
soufron rdmpage theclimbergirl jasebell cwsaylor
- racleace
- racletechnet
DaveNotik
- rical
JosueR florianseroussi chriskjennings apgbrown Anytime23 wordnikapi TanelPoder NASCIO UtahData dfletcher gobansaor roder
yehaskel
zariaman MoreWillie hillbillyToad DavideDiCillo chrisfullman imjameshall kode80 alexdesigns JasonLBaptiste refreshfll ToddHandy eturner303 TomTague tattlerapp
- pencalais
teej_m reybango
bigdata
KineticaRT aejes bleepboxapp autumnrizing dtseiler johnfleming MiamiStartups RedHourBen pioro romannurik jamesturk SethGrimes latonk Infobright rhaces serge_a_storms topperge jaymohr37 EstePizza bigbadbella speedbump19 rhhfla asimkovsky KerryDavids jessjurick benbinary alexdc Lindseym fab9 JohnJamesJacoby bigtallgeoff cgranier mherzber jewgonewild Montgomery billhanifin claudioalegre UlisesOrozco Mic_to_Mic velocast utahcycling ricktuttle CoworkingMiami jpiwowar fltech bobkeroll
vaughanbell
hootsuite
- pdev
jcanello fangelico diogoafe hlaudares everton137
cranatic
msiniscalchi atulskulkarni eagorabr CamaraDeputados dbonis cecillia srpraca twombly10 participatory andlima
- bvio171
BrunoHoffmann ricardopoppi markun doug_rivers Mercadante PollsAndVotes datayoda
bradfordcross
tylercowen MANOELBISNETO Clansman2 CongressoAberto zachgemignani
EagerEyes
matthewlandauer
HarlanH
danielkrull antoniograeff mtaboada marconidutra lmonasterio monileoni sucaleooni krull83 igordutra ErasmoLopes indridih dicaleoni jelkink burtmonroe
sorenmacbeth
ChrisDiehl
kevinweil
cindyalvarez jacobian
- oc_lang
timyoung jrubyist bokardo howardlindzon ariweinberg FiLife STnet shervin sbergel justinsmith chudson getgambit noahkagan viximo bbalfour Playfish liveink zynga blader spullara PaulWalsh elliottng rashmi aargenz1 seanellis innovate StartupPro umairh sumaya ryanjunee gregboutin Brajeshwar alisohani leanstartup HeyItsMinic sgblank danmartell 50Pips dweekly igrigorik 2gov SarahKSilverman edencayen davemcclure andrew_chen abtests RAEKWONICEWATER markpinc mg joestump VirginAmerica richallensf AdamHertz mwegner syalam NASDAQ lcarrillo AnneMarie2006 ericries APIannounce funmotion datajunkies merket commodityG zappos arinewman joemccann qiqong8 STQuotes TalkRetail WeeklyTA vark pricing neilpatel RZAWU hnshah flava404 peterpham ventilla mkjung marquez140 sethjs avivra davemorin charlesamadeus MKFlynn kitode shcgquant delawareliberal boadiceatx ImagineReality Postgrad jeffvermeer timzero4 TheBeerGenome hornpolish delta44 Quintile BlumeEvolution ChristinaMcFaul thepolyglot uponrequest_oc teacherken DrMathochist WriterRoxanne kellygarber bschlenker 6Oct Adenovir philly51 Nadgia angiewritergirl quoteskahuna dsfq ElleKunstlerin paulidoodle MarijuanaInc BeerUniverse lynnwoolsey tbabinszki JulieDD StatsSolutions Michael_Tuchman CoolRaven ChildrensLink statsjobs
- scardelben
steve_g2 purrfect1969 SmithvilleChic lrnchat stats_prof buzzflash Ldyjarhead solazyme tweetprogress jonerthon Hyposomnia JobsWithNatalie ruby3881 freelancersu SrrAB PaulTopping vsummers61 paulinerusert Defender411 meepbobeep silverwaver farfuture math17dotcom MattAltieri thesadredearth CarnivalOfMath statsmd kristinevick analyticbridge mc_tweeter mathslitteacher StrandedWind 1whoknu IrishPatti spedwybabs triciaNC estatistico peterrowlett MATHS_IS_IT elpatronhimself innocenceblog poornank MomieTullottes SawtoothConsult psyc_grad AC_Luke SSessoms Julia_Kline morgan2dope CurtMonash ananelson Luxveritas01 RoniZapin stevebaker
decisionstats
bitterer virtualbox Database_News tamaradull jilldyche Freakalytics jumpbox alisonqer coopaz swcoptac DanicaPatrick alyswoodward billnjax tkgeorge SenJohnMcCain KimLeBouton leslie_pearlman davidbrennan markkorey mnemecek jaburke TrentSmithSAS hrenee sandyvarner ijustine TallgrassBeer BluestemBistro AScottMcCauley schajie sarah_farlee kscorn KansasAgland KSUPhoto HDPhotosOnline petapixel bactiman63 kstate_pres k_state bearlyhip chirimoyaKris pmbard PaulyTwiggy hcwetzel3 djbutler23 Universal5 MandaEllery eckeckah MensHealthMag 47CJ daveontv mpix mstamm3 DSproductions VASparks biergirl foxy211 WilliamShatner CDCemergency RalphHipp EarthVitalSigns jpbigboy sbixel JYMATS mendeley_com HometimeShow JeremyGoodwin meawoppl GISpathway stealthww wibw GeoffLloyd ubuntugeek wibwJosh panamaplants andrewplatham starnold922 kirabri619 ljspop jimogle navteq ecomonkey boyink Worth kenahoo smojump StephenColbert elwood j0v1wan dom Morgan
surewontmiss
surlybikes busynessgirl peeweeherman mtairybike shabbychef IOCCRose Peter_Max rationalfrank cyborgturkey KatrinaNation george_clinton Bootsy_Collins WordsAbtNumbers techreview CARMAGlobe StatCan_eng StatsSweden uclastatconsult statlab methodsctr SPN_Listserv PsychNews SocialPsych peteroverby bigswifty freepmitch DennisHopper KevinSpacey WholeFoodsMTW hfblog wjznews bdinger SelectedShorts WYPR AtheistQOTD helenmirren insidecharmcity under_armour eddieizzard PRI BBBaumgartner John_Lithgow formerlyCwalken thenation jimgaffigan bbcbreaking levarburton ThatKevinSmith trent_reznor kevinpollak BaltimoreMD Vegimentary PRIthislife TowsonU iraglass WTMD baltimoresun planetmoney NotTinaFey MikeDoughtyYeah science teachstreet WholeFoods robert_j_smith biketips PugetSystems danielschorr NPRevents Foodimentary DAVID_LYNCH JohnCleese hodgman jimmyfallon rainnwilson bethanybrand RadioBabe nprlive cmattern Velo_Orange nytimes tomfriedman pennjillette statgrrl tpab hgimenez rands joyofbaking MikeKSmith parselets
bioinformatics
fogonwater teamswivel
KathySierra
jduckles teamapart
shitmydadsays
bmaland
achristoffersen
cshirky fdaapproved stubbornmule Claus sleepybuildings cypriangwozdz jonobacon kimelmose totovader AaronSklar valdiskrebs
mariawolters
coke_no_ice jgarnettTSC joschasauer heigazen michaelfourman benhachey gorskon annetteleonhard jonoberlander kateho johannadmoore jochenleidner BonnieLWebber roomitchell cathschaffstump nickcohen2 DomesticDork fgfinat alun effectmeasure MJMcKean fsjblog markusdahlem wodieskodie jon820 Dr_Aust_PhD philosophybites ginatrapani
- ots_update
MumsInScience hotdogsladies robinince christianblab DataMiningTips jk_rowling Spotify MikeLincoln milesosborne FrauSchussel phdinparenting RealRobertWebb ILCUK VisitScotland HandyAnnie whydokids Gaelicsinger GaelicTweets DailyWelshWords macavram TweetOGE GaelNet bbcnaidheachdan OliverSacks SLSingh MarcusduSautoy daraobriain DerrenBrown EPSRC michaelshermer purcellmurray wildwasser jisaboke pigeonPOLL UKRC Neurotechnology newsomagic kuenne LL_Spanish spanishword languagelog BadStats kesslermichael PharmacistScott sidheag timeshighered laikas montiac712 ProfBrianCox twisst HistoryTODAY TomLevenson jonahlehrer MrTeller
- rzelc
cromercrox scalzi johanlindell
hjl
elunca kkrugler mattsly StanfordWSoccer
btaylor
ricksegal lucene_solr joshelman souders thermous fuselabs simonyun Michael_Yon paraflier erikhatcher raffi patkinsel vambenepe randomroger dataliberation palantirtech webbhk pankaj sftechruns
t
rsarver koreanet philmckinney purplepod TheKirkReport merlyn SoCap09 hackerdojo yeeguy
newsycombinator
gerster hplabs ChurchillClub barrywellman WorldCup2010FC joepruitt MikeOrmond bitnami mikojava rafatali dweinberger zephoria lyndonwong
- taviofff
philosophygeek scire AndiamoMike maanow aari TALENTEDBLONDE whodapunk jhamon kenyarmosh anguslogan
- scon
jodiecongirl stevenplace clairesays Lazyfeed shellen ChrisSaad BoingBoing Keith_Combs geminisecurity svnewtech atveit danielbru Linux bgoldy whuffaoke migueldeicaza traderstewie kaifulee jaichoi peerpong Microsoft stevenic lilich Aptana
- penajax
- pera
SF_BayArea_ACM mozhacks firefox TavernEndWorld trinastarlite BrooklynBrewNE northern_brewer Post390 AtwoodsTavern lupecboston dogfishbeer BostonRy zcicala ScottJablonski Rodneyh37 OGOchoCinco Adam_Schefter Syfy magnushagander EastCoastGrill tmaws ArtisanalBeers magichat creamyradio gamercow DboG Ptrik RPIAlumni shakenbysound bethmckeon Drinkboston GrubStreetBOS programmingjoy zanelamprey cortneykirk Dealhack gmphoenix raphkoster sarkasm fourburgers eatboston MustLoveBeer beer47 TweetDeck geektool 02139now censquare RunCore reasonmag dcerrato BostonTonight cambridgechron John_W_Henry afinley tupelo02139 LiquorWorld MikeReiss JumboHart LaurenceMaroney
andrew02114
greggrosenthal wilfork75 realpatriots BostonTweet pgrenham mideastclub BeerAdvocate imbibe goodeaterdotorg thebostonshaker mcslimjb redsoxcast spampy craigieonmain StanHieronymus rickyhsin dubiousjj wyk5p raserman Vandaliacreek amyg12334 pfwinprogress princesskaite t_redline murrayw76 lorita peplau jmr76 AdobeLR MedicalQuack medigi8 Coccinella1 twitoaster Lifehacker vtrien ahornerdevine MedscapeOnc phaseofmatter Gizmodo MedGeek sciencegoddess palmdoc Epocrates Isis_Maternity JennaBusch hiddenboston Dropbox BrooklineTAB HarvardBooks Boston_Police allthingsd backblaze mozy Paulflevy WSJHealthBlog
- racknows
nytimeskristof freakonomics Gladwell OnPointRadio newtgingrich COILifeScience mkmackey MaverickNY jon_duke gertrud WBURNews huffingtonpost mrskutcher KimKardashian paulpierce34 engadget arstechnica kenrockwell dpreview GlobeMetro Pogue noahparsons stade02 Bela09 nytimespogue CNN jamesbeckerman infobhan CrackLung _brendan_ mikecho95 jguillem mgh_apprentice gkluger jogikalm vandana888 AliciaPalladino vtobak CassBolzDiegnan wesfisher radtke327 hansallegaert grazierphoto ChristyAnnGuarr jeziorsj bijans
- ncotalk
TigerLights DragonKitty drpippa drchapas leepyne jsperber cmpettker danielgm admob dcdeventos chrisgrayson mrinal knocknascheagh YankNancy JohnsonJLB BigSuze SophieChapman theSuperHans JezOsbourne DobbyElf MarkCorrigan DavidSuzukiFDN aubertm angadsingh mattgood scoutmagazine imran johncmunoz dougpete amberportercox xkcd mccandelish wattenberg brucemaudesign toshiroto sween chrisonhismac justinvincent surplussatire thesulk gordonshumway Broslife OHnewsroom CBCNews BrianBBrian mjec knottylinda Global1Events AnalPoet NickHodge easywash twogirlsonecork 24Hin2010 benmoretti jasoncroatto Korayem mmallin walterra trongdoan chris_souchack CHRISVOSS
- nevancouver
wbconservative profitcanada benhoffman BreezeTribe iGoVirtualStaff JohnChow jaimeortizc mmark jonasbuus stephentimothy larsgundersen jl_alfaro pato_rodriguez geirfreysson rodrigo_b carlosmorenop chilenoblack philterdesign bluefog1025 kevinairgid gfbertini patocastro danielherrero Paisa1974 anti_chavista hectorres TwitNEd fleko WalkerLucas marc_smith Razorfish Hector_Luna mkorsario
- netabo
cverdugo leonardolorca ncarvajal cadaunante Paloma fdelaminne sadatshami sigol heif QuoteDaily gilelbaz tlipcon dickc rjurney infoarbitrage williamallthing
cdixon
kennystoltz
avinashkaushik
terrycojones larrylarsen sachinrekhi singhgurjeet
ml_bot
CodeforAmerica matthiasshapiro jamet123 cwensel tgardner4 mattredlon JCVenter dehora brady predictanalytic IntelligentEnt abdur aaronsw picklesnumber1 nickbilton jessicahagy Michael_Koeris terrigriffith DRMacIver nitin
angusdav Caterina
jtlin jkalucki damianblack timoelliott julianhyde JAdP michaelfogcreek aresnick saurabhnanda Jason
cloudera
jpatanooga tom_e_white shuying jchris jny2 idefine
mkapor
john_ryu
MrTweet
alexlundry
CRMOnDemandSFCG ibmbizanalytics radar jlb pahlkadot ericlitman quotations RomanStanek timeplots BrendanNyhan JeanetteMonster ellie_aatheory allisonkilkenny chelseahardass Dichenlachman cl_sex newdemographic racialicious cl_tampa sondambi followWG PIPAworldopinio GlobePierce Literary_Life lizzwinstead whitehouse snapflashphoto annahovet CurryGrrl NathanFillion BenJealous ameluna LiberateLaura weTWEEThard dlaskowski maddow cafehey m_cowan79 englishmonet jmecerretti jmmacha wootoff ajn108 APAforProgress hannahdpowell meera2 pattonjt harrislacewell yaej elonjames angryasianman capcold WBEZpolitics zKorean Chicagoist kenrudin heidikathleen woot mythandros WGsun WGyenny WGmimi PinYoung720 PoliSci_Media waitwait WGyubin jkeens natalietran YEAHRIGHTPOS WBEZ missames disgrasian cmcf entropysagent chinesepod petersagal amclive lifesuggs pintsize0101 hanneloreEC svenbianchi penelopegaines dorabianchi XxSexyRavenxX fayewhitaker tiarala
- olipgloss
hellogcp katie_cake Dugan anamariecox MrBobaFett OakParkGirl janisamonster ariossw dwf PaVStats JSTOR a_maus moritz_stefaner mjbommar another_round nealrichter Techmeme WinfieldFly BetoIII YahooResearch rmason3 socialdata
- neofthehundred
berhanu mikeyk choonkeat
dtunkelang
caltrain ambivalence dokshin THE_REAL_FLUFFY arthurkaneko yo_rachel katy_giorgio dgboy2000 bergus01 johndevor sparklebot jampersand dan_neil kpich jarobb3 elliotcole SHRVL adecherney mingyeow foxonthedocks marcia_lee ericbahn merrells joshuang WilliamsonMark staccatoTaco sfanman9 aweigend alonetone GLUMUSIC backboard sudara dmoneye
bigdataguy
LeenaRao kaiserkuo msaleem a4agarwal joycekim sachinag davidbeisel riotvine kmx jpbutler serendeputy merbist alleyinsider HLMorgan StartupWeekend efrontier BostonPitaPit GreenhornBoston robgo KevinVogelsang TallMatt Evanish flybridgecap
- marh
rich_wong_accel zachklein epaley BeagleBrookline hamersleysbstro CambridgeCarrie dartboston thinglabs DougH hadleystern techstars davidcohen paramount44 andyhusbands ChefToddEnglish michaelschlow Om_Restaurant b_good_ zuzubar cloverfoodtruck CambridgeBrewer TheRegattabar divarestaurant eatatblueroom ChezHenri ArtBarCambridge kickasscupcakes DPastryHouse tosci WestSideLounge middlesexlounge JEG2 atul malouie leadcritic pubcon krisztinaholly MassHighTech dbodbo changds gravityjack witheiler SoKuledotme Akos_Fintor jbchang myersandchang jhong SEGames LaserMotive billwarner lunametrics larryvc bijan richminer BobMetcalfe grader ssuri unthinkingly WebEcology jewelia edbice mattskiva noshir DrJamesLWilson gbblank numbercrunching acapitollife jp_cmu RobertHolderIII jeffreycarr TJHSSTalumni tessalau CamilleDRyan edchi dpsilberberg matthewhurst Astro_Mike hillhannah Brockner katenieder ian_soboroff mikiobraun selil KristinaLerman parry_joe Orbitus ashleyllorens djw2451 JohnGersh jcmayfield ksjhalla judithd cpiatko BelleSauvage the_api_book David_Patrone evernote kimberlyglasgow tedperl pgloor davidgregory sanbeiji pd20 jimaarons patrickmeier meedan ushahidi mpek cameronfactor jessykate kttobin atlamp STAR_TIDES wattzon paulrodrigues sherryfm ict4ddotat BBCNews_Davos09 MideastYouth gkwalejko mysocnet twittervision frogdesign AJGaza Riy dkrape change_congress twollo creativehandle telehelp Amanda_Lenhart claymcclure markkolich kamikaze_bhasin ByDisgn KristaCanfield parand arnabdotorg MSiek boudicca asmartbear stegmanquotes randomwalks pbrane rajanpatel peter_c_william mariosundar danzarrella mattgillooly techforn10 James_Rubino skFTV anutron anthonyj franzd hadoopdc strlen gingi0 malcolmt rayval grosenbush jaxzin microstrategy mat_kelcey bosky101 nburger andyliu1227 saintstack tom_nichols atbrox stuartsierra Aloisius noahcampbell adamnash mallipeddi
- bjectoriented
djsunlight kluo deanwampler mnshah criccomini mysantorini michaelmarth rjzak highlightcam JasonFreedman rwhite5279 stefanvdwalt bill_michels cutting enkido LinkedIn matt_massie quixotic squarecog ryanobjc skeptomai
- tisg
sematext botchagalupe cohortanalysis philz42 schigel seanflannagan dliman streamy greggersh joealex eeble billoley iamdietrich jhaynie drewfarris ShashiTharoor siiimple monomoda Aen Infrastrukt YOUTHPROJECTS fullo HowToMakeMyBlog wandrian jeherve cssbeauty WorkCabin minimalsites
- penDesktop
XFilesNews TIWWA XFQuotes blprnt festedipaese capefarewell hellomuller gaspart LCROSS_NASA Naturejobs ScienceBlogs tharris gregorylouie DulcineadT beautyscientist blumscientific anneminard BoraZ iandstewart wpframework WeGeeknet ilarialab GuyFletcher str8photography UsefulWebApps MikeChelen hostgator phdstudent nasahqphoto whitcher jmcsmith LeDoctor thegreeneconomy MolSoft sciencebase ecorazzi sroakes ecowarriorr ecosphericblog carbonOutreach brightgreen ecogreentravel EcoPreservation vimrecipes dpodolsky stonesoupfilms NaomiStarkman EnnNews YaleE360 greenexaminer NatGeoSociety Worldchanging technicalgreen eco_jo BadAstronomer World_Wildlife nature_org guardianeco rcsbPDB gvanrossum masterrussian OceanDoctor ClimateProject RnfrstAlliance ecojustice_ca katsumushi shuzo_skt nezmi poccopen to_timbuktu lutana2 yu_kubo heiminshinbun sendaitribune haruhiot yukitanuki gokitanuki suzuki1005 hanamame DRIscience herrenmoral rhetorico
- verlast
ScienceNOW NeuroscienceNew xxxmeltdown AmiHide hiroking1975 aisapporo jadeta kokokubeta naturejapan lavieenrose99 whitefullmoon zou_musshu GachapinBlog YXYXYXYXYXYX dankogai complex_cat hisamura75 hayasick shinji_kono DTSG suseum_info kanteikun yamo74 mai_7star main_C hirosh kakaikun Himajin4 asymptoter alukalukaluk cafedeseikuma hokenshi
- mangaman
NeoCat starangler pigya twwwk naoki_yoshioka kzymtn a_yokoi_u_tokyo
- anus
wacking 3DTS
- dahajime
dimaryp hypothesia lickane drug_discovery tsugorou pollyanna_y meigenbot todesking masao206 hearts_ ma_ko ykgy183 murashit snowy0516 coji morihiro impo chainsmoking cc02jp
- dahinata
HappyOcean replore kamma hiromu yuu3 taoo_ icotan mo__ki godkikaku mureru habanamode kubomi0727 kasakiyo kyooyan PayPalx Sequoia_Capital
seanphurley
davidabooth webshare anilbatra mehtarajat adilpereira cgdancy MaxMauriello WebDevOnLinux OReillyMedia hughmcguire DonLinn markcoker debbiestier glecharles jwikert gkiely draccah NathanBransford Weegee MichaelHyatt R_Nash techstartups fratac zazzle qthrul ericcgould iamkhayyam charlesblyth dcervo tub78 raycarroll kimdossey weckerson turbotodd IODGC2009 jreneker daraghobrien ecinoh gigaom hackathorn wherescape marksmithvr BillCosby ldignan MktgExpressions kdemacop PeteWaterhouse workcolab jpbenfield EliseOlding vchalana mgherrmann joe_morrissey kirodriguez JenniferMeacher BettyFeng scm_tweets kitson InformationCTO jameskobielus Danne_Hotchkiss drcasio minethatdata ManagerGuru stuartlaing Len_Silverston zaibatsu erictpeterson Claudia_Imhoff dqchronicle DarrellHudson tweetburst jowyang MatrixSystems skypefb HarvardResearch Scobleizer tacanderson avinash_tiwari SonyPictures Visible_Tech TweetStats godgrrl nenshad
Truviso
dm_the_company dbreakenridge dhollywood widgetgirl LeeBillings emediavitals chiefmartec markmadsen JeromePineau katie_ohea kristathomas BeyeNETWORK TheLarch NadiraHaniff adambain seanpower jacqueswarren gregdowling jdersh edyhaneo deantak patrichards jimsterne johnlovett bosilytics TheBINetwork esammer madmongol radarcg
- renyosifon
juliov27612 billtrippe samcharrington FrankAddante EdNadrotowicz danielwaisberg racoss danmil vmbrasseur taylorbrooks rickmans keithpjolley phillsea johannchiang juspar mmaksin datapop robertobrien jonnylongden GrahamHill VAdickinson ivandojr audiencescience benkuo JuanferPlanb jeff_grant RJMetrics agahran mrosas jmclifton CloudMarkets richardbaxter MurphyJason mark8west sjdagutis TheNextCorner environation afterthesea BK4D Unit4Agresso pyesawichjr katopz editedforbias asmitthipong ciorant techforce BeforeShot nozap gtiadvisors tweetgrab IBMCognosCTO slozinsky ifthenelse TomaBonciu dstojka BuzzEdition Wordination davewiner IttyBiz Rhea Sully blinker GailFerreira rosegrabowski JSForman attensity markbao awmoore wsul stephenrandall lifeoffbi julito77 tlists mitsmr anlantz brendam mstoddard danviv studiomiki datamarket BilalJaffery Casieg GetGrasshopper umassbostonweb Judy_LC tinoboston SloanNetwork 451Heat GregBarrette KarenYetter MomCentral kathyoreilly MelindaWeekes crystalppr CourtSpencer LimitlessInc davidalston LisaBarone PRsarahevans davidcushman kanter Tech_Blend ajleon vanhoosear NoOneYouKnow garyvee BillAulet chrisgarrett GeekMommy chrisbrogan ScottMonty jangles Ryan_Mackenzie kcapelluto foursquare dens EricOlson BryanBeshore tristanwalker reecepacheco MaximizeROI AndrewFlint yellowjaguar hadkhai marcusborba vandegrift AnalyticsPierce remfield kn0thing kimblem erhardt zapnap TNMstudio tedmurphy JoshuaSOnysko SeventhGen slavana tikitosca compcomcon jwb713 CLCbio RaphaelJS shellfu unixdaemon sijoe pinin4fjords jstrachan cbeust iddux richhickey clojure thedeadline IanMulvany heikkil ensembl bio_hax codemonkeyism kraih templedf sungridengine insideHPC allisonrandal RickMoynihan bashcookbook Connotea chipsalz BioInfo
- tterbook
BioDataMining jandot per_ly BrunoVi wonkden jrockway genehack molmodelblog CPANr szabgab standaloneSA cass_j perloneliner perlcritic OvidPerl perlbpbook chromatic_x perlbuzz
mcmdock
Hypios HomerJSimpson Wolfram_Alpha chris_nicholls RichardWiseman cgseife DrShawn1 jeffjarvis jayrosen_nyu robocrunch WSJNumbersGuy rww PaulMiller programmableweb novaspivack alexiskold recomme mariagrineva yarapavan xamat ShoestringGal communicating izendejas diveintomark kirkjdavis
- penamplify
barrysmyth dbboardman richardalois SteveMirsky chrisada sciammind sciam linkibol chrispirillo johnbattelle gregory Pythonner semanticnews
- ptian
tweetblockerapp marissamayer PageInNYC lizstrauss MarkHornick NYTimesDowd nytimesbits eldon tonyrobbins nytimesscience stevenbjohnson itconversations longreads markoff rushkoff jennyholzer waltmossberg leolaporte briansolis arrington pomeranian99 Richard_Dawkins dannysullivan louisgray chasemurdock
5000 10000 15000 20000 res
a
−0.4
a
−0.2
a a
0.2
a
0.4
a
0.6 abs(res)
a
0.1
a
0.2 a 0.3
a
0.4
a
0.5
a
0.6 Drew Conway Making Pretty Pictures with ggplot2
Introduction Scatter Plots Time Series Plots Other Examples and Online Resources Key Actor Analysis Tipping by Sex
Tipping: Women vs. Men
Using the pre-loaded data tips we will create a simple comparative scatter plot
- f total bill amount vs. the subsequent tip paid by both women and men.
> # Create plot > tip.bysex<-ggplot(tips,aes(total_bill))+ + geom_point(aes(y=tip,colour=tip/total_bill))+xlab("Total Bill Amount")+ + ylab("Tip")+facet_wrap(~sex,ncol=2) > tip.bysex<-tip.bysex+opts(title="Tipping: Women vs. Men")
◮ By using the facet_wrap() we will have two plots in a single chart; each
corresponding to the tipping data for women and men respectively
◮ By setting colour=tip/total_bill the plot will highlight which sex contains
more “outlier tippers”
Drew Conway Making Pretty Pictures with ggplot2
Introduction Scatter Plots Time Series Plots Other Examples and Online Resources Key Actor Analysis Tipping by Sex
Plot of Tipping Trends by Sex
Tipping: Women vs. Men
Total Bill Amount Tip
2 4 6 8 10 Female
- 10
20 30 40 50 Male
- ●
- ●
- 10
20 30 40 50 tip/total_bill
- 0.1
- 0.2
- 0.3
- 0.4
- 0.5
- 0.6
- 0.7
Drew Conway Making Pretty Pictures with ggplot2
Introduction Scatter Plots Time Series Plots Other Examples and Online Resources Major EU Stock Indices Driver Fatalities in the U.K. and Seatbelt Law
Plotting the Daily Closing Price of Four Major EU Stock Indices
Using the base datasets package we will plot the daily closing price of the DAX, SMI, CAC and FTSE from 1991 through 1998
◮ This data set is a ts object, so we must first convert it to a data frame
with a time vector
> # Create data frame and add time vector > eu<-data.frame(EuStockMarkets) > eu<-transform(eu,time=time(EuStockMarkets)) > # Create base plot object > eu.plot<-ggplot(eu,aes(time))
◮ Now add the stock price data and appropriate legend
> # Add stock price data > eu.plot<-eu.plot+geom_line(aes(y=DAX,colour="DAX"))+ + geom_line(aes(y=SMI,colour="SMI")) > eu.plot<-eu.plot+geom_line(aes(y=CAC,color="CAC"))+ + geom_line(aes(y=FTSE,colour="FTSE")) > # Create title and legend > eu.plot<-eu.plot+opts(title="Daily closing stock prices of + Major EU Stock Indices")+xlab("Year")+ylab("Closing Price") > eu.plot<-eu.plot+scale_colour_manual(name="Indices", + values=c("DAX"="black","SMI"="blue","CAC"="red","FTSE"="green"))
Drew Conway Making Pretty Pictures with ggplot2
Introduction Scatter Plots Time Series Plots Other Examples and Online Resources Major EU Stock Indices Driver Fatalities in the U.K. and Seatbelt Law
Plot of Closing Price for Major EU Stock Indices
Daily closing stock prices of Major EU Stock Indices
Year Closing Price
2000 3000 4000 5000 6000 7000 8000 1992 1993 1994 1995 1996 1997 1998 Indices DAX SMI CAC FTSE Drew Conway Making Pretty Pictures with ggplot2
Introduction Scatter Plots Time Series Plots Other Examples and Online Resources Major EU Stock Indices Driver Fatalities in the U.K. and Seatbelt Law
What Impact did Seatbelt Laws have on Driver Fatalities in the UK?
Using the Seatbelts dataset we will attempt to visualize the impact of seatbelt legislation on driver deaths in the UK
◮ The data contains monthly fatality data from 1969-1984 with a dummy
variable for the month/year the seatbelt law went into effect
◮ Automobile accidents will likely have a seasonal component, so we will also
want to examine the data on a month-by-basis
> # Create data frame from ts object and add year/month data > seatbelts.data<-as.data.frame(Seatbelts) > seatbelts.data<-transform(seatbelts.data,year=floor(as.vector(time(Seatbelts))) + month=(rep(1:12,nrow(seatbelts.data/12)))) > # Create a plot that shows seasonality of accidents as well as effect of law > driver.plot<-ggplot(seatbelts.data,aes(year,DriversKilled, + colour=law))+geom_line()+xlab("Year")+ylab("Drivers + Killed")+facet_wrap(~month,ncol=6) > driver.plot<-driver.plot+opts(title="Drivers Fatalities in U.K. + by Month from 1969-1984")
Drew Conway Making Pretty Pictures with ggplot2
Introduction Scatter Plots Time Series Plots Other Examples and Online Resources Major EU Stock Indices Driver Fatalities in the U.K. and Seatbelt Law
Drivers Fatalities in U.K. by Month from 1969-1984
Drivers Fatalities in U.K. by Month from 1969−1984
Year Drivers Killed
60 80 100 120 140 160 180 60 80 100 120 140 160 180 1 7 1970 1972 1974 1976 1978 1980 1982 1984 2 8 1970 1972 1974 1976 1978 1980 1982 1984 3 9 1970 1972 1974 1976 1978 1980 1982 1984 4 10 1970 1972 1974 1976 1978 1980 1982 1984 5 11 1970 1972 1974 1976 1978 1980 1982 1984 6 12 1970 1972 1974 1976 1978 1980 1982 1984 law 0.2 0.4 0.6 0.8 1 Drew Conway Making Pretty Pictures with ggplot2
Introduction Scatter Plots Time Series Plots Other Examples and Online Resources
Additional Resources
Learning R Blog
http://learnr.wordpress.com/
An outstanding resource for examples
- f how to use ggplot2 for several
plotting tasks ◮
Some of the most useful posts are the many side-by-side comparisons of lattice and ggplot2
gcsescore Percent of Total 10 20 30 2 4 6 8 2 2 4 6 8 4 6 2 4 6 8 8 10 20 30 10 gcsescore count 500 1000 1500 2000 500 1000 1500 2000 6 2 4 6 8 2 8 2 4 6 8 4 10 2 4 6 8
Hadley’s Resources
http://had.co.nz/ggplot2/
The developer has numerous resources and examples on his website ◮
The reference manual > data(movies) > m <- ggplot(movies, aes(x = rating)) > m <- m + geom_histogram()
rating count 1000 2000 3000 4000 5000 6000 2 4 6 8 10
◮
The ggplot2 book ◮ Mastering the grammar of graphics ◮ Building up a plot layer by layer ◮ A toolbox of techniques ◮ Scales, axes and legends ◮ Positioning ◮ Manipulating data
REvolution Computing Blog
http://blog.revolution-computing.com/
Choropleth Challenge ◮
Plotting the US unemployment data
- n a color-coded map
Promoting open government in Brazil ◮
DC R hacker Eduardo Leoni uses ggplot2 at CongressoAberto.com.br Drew Conway Making Pretty Pictures with ggplot2