I made a plot with a 3 million points and saved it as PNG. It took a few hours and I would like to avoid re-drawing all the points.
How can I generate a new plot that has this PNG as a background?
set_facecolor() method is used to change the inner background color of the plot. figure(facecolor='color') method is used to change the outer background color of the plot.
There is no option in Format pane to make the R visual background to be transparent. Only small part (around the R visual) can be transparent as below. But we should be able to set bg="transparent" to make it to be transparent like below. Could you please share your R scripts written in the R script editor?
Try this:
library(png) #Replace the directory and file information with your info ima <- readPNG("C:\\Documents and Settings\\Bill\\Data\\R\\Data\\Images\\sun.png") #Set up the plot area plot(1:2, type='n', main="Plotting Over an Image", xlab="x", ylab="y") #Get the plot information so the image will fill the plot box, and draw it lim <- par() rasterImage(ima, lim$usr[1], lim$usr[3], lim$usr[2], lim$usr[4]) grid() lines(c(1, 1.2, 1.4, 1.6, 1.8, 2.0), c(1, 1.3, 1.7, 1.6, 1.7, 1.0), type="b", lwd=5, col="white")
Below is the plot.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With