knitr::opts_chunk$set(warning = FALSE, message = FALSE)
library(tidyverse)
Bar Graphs & Pie Charts
tribble(
~City, ~County, ~State, ~Population,
"Columbia", "Howard", "Maryland", 106600,
"Houston", "Harris", "Texas", 2288000,
"Albany", "AlbanyC", "New York", 98617,
"Anaheim", "Orange", "California", 341035,
"Chicago", "Cook", "Illionis", 9286795,
"Phoneix", "Maricopa", "Arizonia", 1682515,
)-> DataP
ggplot(data = DataP, aes(x = City, y = Population)) +
geom_bar(stat = "identity")
ggplot (data = DataP) +
geom_bar(mapping = aes(x = City, y = Population ,fill = City), stat = "identity")
bar_plot<- ggplot(DataP, aes(x="City", y = Population, fill=City))+
geom_bar(width = 2.0, stat = "identity")
bar_plot
pie <- bar_plot + coord_polar("y", start=1)
pie +
ggtitle("City Population Chart")
pie
ggplot(diamonds, aes(x = price, y = depth )) +
geom_violin()