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,
  ...
)

Arguments

df

a data.frame with three colums x coord,y coord,img_names

scale

a numeric between 0 and 1 (used to resize the images)

size

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%)

pathimages

path to the images

cexaxis

cex.axis of the plot function

cexlab

cex.lab of the plot function

labelx

label of the x axis

labely

label of the y axis

lm

TRUE or FALSE (compute and draw the lm)

xR

x coordinate of the position of the R2 on the plot

yR

y coordinate of the position of the R2 on the plot

colR

color of the R2 on the plot

cexR

size of the R2 on the plot

colline

col of the abline used to illustrate the lm

lwline

lwd of the abline used to illustrate the lm

ltyline

lty of the abline used to illustrate the lm

...

other plot options; see ?par (as mar or mpg)

Value

a plot

Examples

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)
}