Having trouble inserting PNG logo from desktop and having it integrate with the ggplot chart below. I read there were issues using raster with on Windows platform but can't be sure if that's the case.
library(png)
library(grid)
library(ggplot2)
library(reshape2)
img <- readPNG(system.file("img", "Rlogo.png", package="png"))
g <- rasterGrob(img, interpolate=TRUE)
df <- melt(economics[, c("date", "psavert", "uempmed")], id="date")
ggplot(df, aes(x = date, y = value)) +
geom_line(aes(color = variable), size=1) +
scale_color_manual(values = c("#999999", "#E69F00")) +
theme_minimal() +
annotation_custom(g, xmin=as.numeric(as.Date("1980-01-01")), xmax=as.numeric(as.Date("1990-01-01")), ymin=-Inf, ymax=5)
Also, I imported my logo but the image is either just a black box or a white box and not displaying the logo. How can I resolve this issue? I checked to ensure the logo.PNG wasn't encrypted or protected. Thank you for your time.