Last active
December 13, 2020 09:38
-
-
Save audhiaprilliant/5ead8c3eb2f983e000f1de97d5a02e08 to your computer and use it in GitHub Desktop.
Twitter Data Visualization using ggplot2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # JOKO WIDODO | |
| df.score.1 = subset(senti.jokowi,class == c('Negative','Positive')) | |
| colnames(df.score.1) = c('Score','Text','Sentiment') | |
| # Data viz | |
| ggplot(df.score.1)+ | |
| geom_density(aes(x = Score, | |
| fill = Sentiment), | |
| alpha = 0.75)+ | |
| xlim(c(-11,11))+ | |
| labs(title = 'Density Plot of Sentiment Scores', | |
| subtitle = 'Joko Widodo', | |
| caption = 'Twitter Crawling 28 - 29 May 2019')+ | |
| xlab('Score')+ | |
| ylab('Density')+ | |
| theme_bw()+ | |
| scale_fill_brewer(palette = 'Dark2')+ | |
| theme(legend.position = 'bottom', | |
| legend.title = element_blank()) | |
| # PRABOWO SUBIANTO | |
| df.score.2 = subset(senti.prabowo,class == c('Negative','Positive')) | |
| colnames(df.score.2) = c('Score','Text','Sentiment') | |
| # Data viz | |
| ggplot(df.score.2)+ | |
| geom_density(aes(x = Score, | |
| fill = Sentiment), | |
| alpha = 0.75)+ | |
| xlim(c(-11,11))+ | |
| labs(title = 'Density Plot of Sentiment Scores', | |
| subtitle = 'Prabowo Subianto', | |
| caption = 'Twitter Crawling 28 - 29 May 2019')+ | |
| xlab('Density')+ | |
| ylab('Score')+ | |
| theme_bw()+ | |
| scale_fill_brewer(palette = 'Dark2')+ | |
| theme(legend.position = 'bottom', | |
| legend.title = element_blank()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment