** Muhammad Salman Shah Question 3 part 1: Scatterplot**

options(scipen=999)
library(ggplot2)
g <- ggplot(midwest, aes(x=area, y=poptotal))
g + geom_point() + geom_rug() + ggtitle("Scatterplot")

** part 2: Rectifying concentration by rescaling in log form**

g + geom_point() + geom_rug() + ggtitle("Scatterplot")+ scale_y_log10()

part 3: changing the color and size of points

g + geom_point(colour="blue", size=1.5) + geom_rug() + ggtitle("Scatterplot")+ scale_y_log10()

part 4: color of state

ggplot(midwest, aes(x=area, y=poptotal, color=state)) + geom_point() + geom_rug() + ggtitle("Scatterplot")+ scale_y_log10()

part 5: changing x and y axis text and location

gg<-ggplot(midwest, aes(x=area, y=poptotal, color=state)) + geom_point() + geom_rug() + ggtitle("Scatterplot")+ scale_y_log10()
gg + labs(x = "Area", y= "Population in Total")

part 6: Bubble Charts: The bubble plots are used where the area of dots is propotional to their numerical values

Question 2a

library(leaflet)
my_map <- addMarkers(addTiles(leaflet()), lat=33.72148, lng=73.0433, popup = "Hello from Islamabad!!")
my_map

**Question # 2b 1: The plot will be a scatterplot from the dataset mpg with x=cty and y=hwy 2: The plot will be a scatterplot from the dataset diamonds and x and y cordinates are comparing carat and prices respectively. 3: The plot will be a line plot, showing time on x-axis and unemployment in the form of line representing y-axis from the dataset economics. 4: The function will plot a histogram of cty from the dataset mpg

Question 2c:

A continuous variable cannot be mapped to shape as it would require a lot of different shapes to be graphed and shapes cannot be tranformed too.

Question 2d:

using facet_wrap(~ class, nrows=2, ncol=4)**

Question 2e: Recreate R code

ggplot(mpg, aes(cty,hwy)) + geom_point()

ggplot(diamonds, aes(carat, price)) + geom_point()

ggplot(economics, aes(date, unemploy)) + geom_line()

ggplot(mpg, aes(cty)) + geom_histogram()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Question 1: Birth chart recreated: Created on Excel File

The graph has verious short comings: #1: Choice of stack bars is not suitable i.e. 4 time slots thus adding so much complexity.

2: Comparison between the bars cannot be easily done thus adding cognitive load to understand the graph.

3: Bolding the title of graph is shifting the focus towards the title, while the main focus of our graph should not have been to the title.

4: The gridlines are adding the usage of more ink, whereas less ink usage is preferrable.

5: The graph is not designed in a Zig-zag manner i.e. the natural flow of our eyes.

6: Furthermore, the label of axis are not well defined and may not be necessary when we are labeling the graph itself.

7: The legends are not adequately placed in the graph.