MENU

Fun & Interesting

How to Create Line Chart in R with Points using ggplot2 & plotly | R Programming Tutorial

Data For Knowledge 10,184 3 years ago
Video Not Working? Fix It Now

Learn how to create a dynamic line chart with points using ggplot2 and Plotly in this R Programming tutorial! In this step-by-step guide, I'll show you how to manipulate your data, pivot it, and build an interactive visualization. We'll take a real-world dataset of STEM teachers in Scotland and walk through the process of cleaning and reshaping the data, plotting trends, and adding interactivity. ⏱️Timestamps: 00:00 How to create a line chart in R 00:55 Set up R script and load data 02:20 Pivot using pivot_longer (tidyr package) 05:25 Set up chart (ggplot2 package) 07:45 Add trend line 09:05 Add points 09:55 Add labels to chart 11:55 Themes (theme()) changes to bar chart 15:00 Comma separate values on the Y axis 16:20 Add popup on hover over of dot (plotly) package ?There is a lot more alterations which can be done to the chart using ggplot2 and plotly. A reference which you may find helpful - https://ggplot2.tidyverse.org/reference/index.html and https://plotly.com/r/ ➡️ The excel spreadsheet used in this project can be found at https://dataforknowledge.co.uk/r-project-create-line-chart/ ⚠️ Note: 3rd party data was used in this project therefore I take no responsibility for the quality or accuracy or interpretation of the data. The data can be found at https://www.gov.scot/publications/teacher-census-supplementary-statistics/ ? Like and subscribe to the channel for more R Programming tutorials! https://www.youtube.com/@DFK_data?sub_confirmation=1 ? For more R Programming tutorials check out the playlist: https://www.youtube.com/playlist?list=PL856L03J0TRzutyNPb5yD2glKnrcWKpFm ? Popular learn R videos. Please check them out: ✅ https://youtu.be/2mkVvWFs4k8?si=Zk9jmmZejYNEKI5f ✅ https://youtu.be/DhJDI6h1vRE?si=7WtqPSjf7JAlbJe9 ✅ https://youtu.be/gkE5hToDFJg?si=P1nG8FRhLBN-7by_ ? Follow me on LinkedIn: www.linkedin.com/in/pauline-cairns-data #rprogramming #ggplot2 #linechart #data #dataanalysis #datavisualizationtools #programming #rprogrammingforbeginners #datavisualization #rstudio #datascience

Comment