Plot two variables using images png as points.Works with any king of png, the best stratgegy is to use png with no backgrounds. Parameter scale and size are important to tune to make the plot readable and not to heavy Must be plotted (or saved) on a 1:1 dimension
plot_2d_img(
df,
scale,
size,
pathimages,
cexaxis,
cexlab,
labelx,
labely,
lm,
xR,
yR,
colR,
cexR,
colline,
lwline,
ltyline,
...
)
a data.frame
with three colums x coord,y coord,img_names
a numeric between 0 and 1 (used to resize the images)
the parameter size of the function imager::resize (between -0L and -100L) used to reduce the resolution of the image (proportion between 0 and 100%)
path to the images
cex.axis of the plot function
cex.lab of the plot function
label of the x axis
label of the y axis
TRUE or FALSE (compute and draw the lm)
x coordinate of the position of the R2 on the plot
y coordinate of the position of the R2 on the plot
color of the R2 on the plot
size of the R2 on the plot
col of the abline used to illustrate the lm
lwd of the abline used to illustrate the lm
lty of the abline used to illustrate the lm
other plot options; see ?par (as mar or mpg)
a plot
if (FALSE) {
set.seed(3)
df <- cbind.data.frame(x=runif(10, 0, 10),y=runif(10, 0, 10),
img_names=paste0("img_",rutils::leading_zero(1:10)))
pathimages <- system.file("extdata", "plot2dimg", package = "rutils")
plot_2d_img(df,scale=0.2,size=-35L,pathimages,
lm=TRUE,xR=1.5,yR=10,colR="gray",cexR=1.5,colline="gray",lwline=2,ltyline=2,
labelx="Variable x",labely="Variable y",mar=c(8, 9, 4.1, 2.1),mgp=c(6,2,0),
cex.lab=2.5,cex.axis=1.5)
}