#RProgramming #DataVisualization #DataAnalysis #DataScience #CodingTutorial #RStats #ggplot2Tutorial #PoliticalDataViz #MaharashtraPolitics #VisualizationInR #DataStorytelling #TechEducation #OpenSource #ProgrammingTips #GraphPlotting #DataAnalytics #LearnR #YouTubeTutorial #TechCommunity #DataGeeks #ProgrammingJourney #VisualData #DataInsights #PoliticalSeats #ProgrammingCommunity #CodeLearning #EducationalContent #RDataViz #TechSkills #CodingForBeginners #AnalyticsInR #YouTubeLearning #DataDrivenDecisions #CodingJourney #RStudio #DataRepresentation #TechExplained #DataJournalism #CodingTips #VisualizeData #PoliticalTrends #TechTutorial #ProgrammingConcepts #EffectiveVisualization #TutorialTuesday #TechUpdates #DataGraphs #RProgrammingCommunity #CodingBeginner #SkillBuilding #PoliticalScienceData #TechLearning #CodeNewbie #RStudioTips #RProgrammingBeginner #DataPresentation #PoliticalAnalysis #CodeLearningJourney #DataPlotting #MaharashtraElectionsAnalysis
Dive into the world of data visualization with our latest tutorial! In this video, we break down the R programming code step by step to create an insightful graph depicting the seats won by two major political parties, BJP and Shivsena, in Maharashtra over the years.
Learn the principles of effective graph plotting using the ggplot2 package in R. Understand how to structure your data using tibbles, and explore the use of different geometries such as points, paths, and text labels to enhance the visual representation.
Follow along as we guide you through the process of creating a captivating plot that not only showcases the trends in seat distribution but also includes engaging annotations using ggrepel. Gain practical insights into customizing themes and labels for a polished and professional-looking graph.
Whether you're a beginner in R programming or looking to refine your data visualization skills, this tutorial is tailored for you. Unlock the power of ggplot2 and turn your data into compelling stories.
code used
Load the tibble library for creating data frames
library(tibble)
Create a data frame named 'df' using tribble
df = tribble(
~year, ~seats, ~pc,
1990, 42, 10.71,
1995, 65, 12.80,
1999, 56, 14.54,
2004, 54, 13.67,
2009, 46, 14.02,
2014, 122, 27.08,
2019, 105, 25.75,
1990, 52, 15.94,
1995, 73, 16.39,
1999, 69, 17.33,
2004, 62, 19.97,
2009, 45, 16.26,
2014, 63, 19.3,
2019, 56, 16.41
)
Display the data frame 'df'
df
Add a new column 'party' to the data frame using rep() function
df$party = rep(c("BJP", "Shivsena"), each = nrow(df) / 2)
Load the ggplot2 and ggrepel libraries for creating plots
library(ggplot2)
library(ggrepel)
Create a scatter plot with labeled points using ggplot
ggplot(df, aes(x = year, y = seats, color = party, label = seats)) +
geom_point(size = 3) +
geom_path(size = 1) +
geom_text_repel(vjust = -0.7) +
theme_classic() +
labs(title = "Seats won by two political parties in Maharashtra")
Don't forget to like, share, and subscribe for more tutorials on R programming, data analysis, and visualization. Hit the bell icon to stay updated on our latest content! Happy coding!
Facebook page:
/ rajendrachoureisc
Mail Id:
rajuchoure@gmail.com
youtube playlist:
• R programming tutorials
On this page of the site you can watch the video online Data Visualization using ggplot2: How to plot progress using line plot with a duration of hours minute second in good quality, which was uploaded by the user Rajendra Choure 13 January 2024, share the link with friends and acquaintances, this video has already been watched 798 times on youtube and it was liked by 30 viewers. Enjoy your viewing!