0% found this document useful (0 votes)
15 views2 pages

Data Visualization in R Detailed Notes

The document provides an overview of data visualization in R, highlighting its importance in exploratory data analysis and decision-making. It covers various graphics systems in R, including Base R Graphics and the ggplot2 package, along with examples of basic plots and customization techniques. Additionally, it emphasizes best practices for effective visualization and applications in areas such as sales analysis and market trends.

Uploaded by

Kajal Singh
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views2 pages

Data Visualization in R Detailed Notes

The document provides an overview of data visualization in R, highlighting its importance in exploratory data analysis and decision-making. It covers various graphics systems in R, including Base R Graphics and the ggplot2 package, along with examples of basic plots and customization techniques. Additionally, it emphasizes best practices for effective visualization and applications in areas such as sales analysis and market trends.

Uploaded by

Kajal Singh
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Data Visualization in R - Detailed Notes

1. Introduction to Data Visualization


Data visualization is the graphical representation of data to identify patterns, trends, and relation

2. Importance
- Helps in Exploratory Data Analysis (EDA)
- Identifies trends and outliers
- Supports business decision-making
- Improves communication of insights

3. Graphics Systems in R
- Base R Graphics
- ggplot2 Package
- Lattice Package
- Plotly (Interactive Visualization)

4. Basic Plots in Base R

Scatter Plot:
plot(x, y)

Line Plot:
plot(x, y, type="l")

Bar Plot:
barplot(data)

Histogram:
hist(data)

Boxplot:
boxplot(data)

Pie Chart:
pie(data)

5. ggplot2 Package
Developed by Hadley Wickham.
Based on Grammar of Graphics.

Install:
[Link]("ggplot2")
library(ggplot2)

Example Scatter Plot:


ggplot(data=mtcars, aes(x=wt, y=mpg)) +
geom_point()

Example Histogram:
ggplot(data=mtcars, aes(x=mpg)) +
geom_histogram(bins=10)

6. Grammar of Graphics Components


- Data
- Aesthetic Mapping (aes)
- Geometries (geom_)
- Statistical Transformations
- Scales
- Coordinates
- Themes

7. Customization
- theme_minimal()
- scale_fill_manual()
- facet_wrap()

8. Saving Plots
ggsave("[Link]")

9. Interactive Visualization
Using plotly package for interactive charts.

10. Best Practices


- Choose correct chart type
- Avoid clutter
- Proper labeling
- Use appropriate colors
- Avoid misleading scales

Applications:
- Sales Analysis
- Financial Forecasting
- Market Trends
- Customer Analysis

You might also like