Plot using GGPLOT

library(RCurl)
x <- getURL("https://raw.githubusercontent.com/JSchrager94/STA-553/main/Data/penguins.csv?token=GHSAT0AAAAAABQ7IHI3L2FWUPSS334LFIQOYP3B62A")
p <- read.csv(text = x)


bill_flipper_plot <- ggplot(data= p) + geom_point(mapping = aes (bill_length_mm, flipper_length_mm, color= species, shape=species, size=body_mass_g))


penguin_plot <- bill_flipper_plot + labs(x = "Bill Length", y = "Flipper Length", title = "Bill Length vs Flipper Length")
penguin_plot<- penguin_plot + theme_classic() + labs(title = "Bill Length vs Flipper Length", subtitle = "Plot points proportional to body mass",caption = "Jonah Schrager STA 553")
penguin_plot + scale_color_brewer(palette = "Dark2")

myurl <- "https://i.dailymail.co.uk/i/pix/2015/03/06/2660A3DA00000578-0-The_local_rockhopper_penguins_are_hugely_popular_with_visitors-m-79_1425649402734.jpg"
z <- tempfile()
download.file(myurl,z,mode = "wb")
pic <- readJPEG(z)
raster.penguin <- as.raster(pic)




pic2 <- penguin_plot + 
  inset_element(p = raster.penguin,
                left = .05,
                bottom = .65,
                right = .25,
                top = .95)
pic2