Skip to content

Instantly share code, notes, and snippets.

@chelseaparlett
Created April 21, 2020 18:56
Show Gist options
  • Save chelseaparlett/b4892c57c51ae44d68fcfce38f296389 to your computer and use it in GitHub Desktop.
Save chelseaparlett/b4892c57c51ae44d68fcfce38f296389 to your computer and use it in GitHub Desktop.
a <- read.csv(url("https://raw.githubusercontent.com/cmparlettpelleriti/CPSC392ParlettPelleriti/master/Data/PopDivas_data.csv"))
b <- read.csv(url("https://raw.githubusercontent.com/cmparlettpelleriti/CPSC392ParlettPelleriti/master/Data/cereal.csv"))
c <- read.csv(url("https://raw.githubusercontent.com/cmparlettpelleriti/CPSC392ParlettPelleriti/master/Data/BreastCancer.csv"))
#red yellow blue purple green pink black white rainbow
library(ggplot2)
red <- ggplot(a, aes(x = artist_name, y = energy, fill = artist_name)) +
geom_violin() + scale_fill_manual(values = c("red", "red1", "red2", "red3", "red4", "firebrick4")) +
geom_boxplot() + ggtitle("Pop Divas Song Energy")
red
yellow <- ggplot(a, aes(x = artist_name, fill = artist_name)) + geom_bar() +
scale_fill_manual(values = c("gold", "gold1", "gold2", "gold3","goldenrod", "gold4")) +
ggtitle("Pop Divas # Songs")
yellow
blue <- ggplot(a, aes(x = danceability, fill = artist_name)) + geom_density(alpha = 0.5) +
ggtitle("Pop Divas Danceibility") + scale_fill_manual(values = c("steelblue", "steelblue1", "steelblue2", "steelblue3", "steelblue4", "navyblue"))
blue
purple <- ggplot(b, aes(x = shelf, fill = mfr)) + geom_bar() +
ggtitle("Cereal Brand by Shelf") +
scale_fill_manual(values = c("plum4", "darkorchid", "darkorchid1", "darkorchid2", "darkorchid3", "darkorchid4", "purple4"))
purple
green <- ggplot(b, aes(x = sodium, y = fiber, color = factor(shelf))) + geom_point(cex = 4) +
scale_color_manual(values = c("olivedrab1", "olivedrab3","olivedrab4")) +
ggtitle("Sodium x Fiber for Cereal Shelves")
green
pink <- ggplot(c, aes(x = diagnosis, y = radius_mean, fill = diagnosis)) +
geom_boxplot() + geom_point() + scale_fill_manual(values = c("pink", "hotpink")) +
ggtitle("Breast Cancer Radius Mean")
pink
black <- ggplot(c, aes(x = smoothness_mean, concavity_mean)) +
geom_point() + ggtitle("Concavity and Smoothness") + theme_bw()
black
anycolor <- ggplot(a, aes(x = danceability, y = valence, color = artist_name)) + geom_point(cex = 2) +
ggtitle("Pop Divas Valence + Danceability")
anycolor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment