I have a dataframe with two variables plotted along the x- and y-axis, as a simple scatter plot, and I would like to add a third variable, but instead of getting the z-axis, I want to represent the points density of said z variable as a background for the scatterplot. I would look like this, taken from the litterature:
Data would not matter as I would work with the general method for such a plot, but you can use something like this:
df<-data.frame(IDOBS=c(1:1000),var1=runif(1000,0,30),var2=runif(1000,1500,3000),var3=runif(1000,0.5,1.5))
So with var1 and var2 as x and y variables respectively, and the background depending on var3.
Thank you in advance for your help,
C.


