custom geom text colors in ggplot2 with R -


i want visualize tennis data using ggplot. far able visualize data based on winner/loser data.

2015    flavia pennetta 81 2014    serena williams 65 2013    serena williams 109 2012    serena williams 94 2011    samantha stosur 61 2010    kim clijsters   58 2009    kim clijsters   82 2008    serena williams 89 2007    justine henin   70 2006    maria sharapova 66 2015    roberta vinci   47 2014    caroline wozniacki  49 2013    victoria azarenka   91 2012    victoria azarenka   87 2011    serena williams 41 2010    vera zvonareva  31 2009    caroline wozniacki  66 2008    jelena jankovic 79 2007    svetlana kuznetsova 54 2006    justine henin   58 

here code:

ggplot(data=f_data, aes(x=year, y=winner_totalpointwon, fill=output)) +   geom_bar(stat="identity", position=position_dodge())+geom_text(aes(label=winner), position = position_dodge(0.9),vjust=0,angle=90) 

enter image description here

how can change text color of names grouped player names each player can represented distinct color?

how (i used first name):

ggplot(data=f_data, aes(x=year, y=winner_totalpointwon, fill=output)) +       geom_bar(stat="identity", position=position_dodge())+ geom_text(aes(label=winner, colour=winner, size=5), position = position_dodge(0.9),vjust=0,angle=90) 

with output

text different colors


Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -