draw x-y plot in r where the size of the scatter is by size of column z in r

You can create a scatter plot in R using plot() function and adjust the size of the markers on the plot according to the values of z column using the cex parameter. Here is an example:

main.r
# Sample data
x <- c(1, 2, 3, 4, 5)
y <- c(2, 4, 6, 8, 10)
z <- c(10, 20, 30, 40, 50)

# Create the plot with the size of the markers determined by 'z'
plot(x, y, cex = z/10, pch = 16)    # 'pch' sets the marker symbol

# Add labels
title(main = "Scatter Plot with Marker Size by Z Column")
xlab <- "X Axis"
ylab <- "Y Axis"
zval <- "Z Value"
xlabel <- paste(xlab, "\n", sep = "")
ylabel <- paste(ylab, "\n", sep = "")
zlabel <- paste(zval, "\n", sep = "")
title(main = "Scatter Plot with Marker Size by Z Column", xlab = xlabel, ylab = ylabel)
legend(x = "topleft", legend = zlabel, pch = 16, pt.cex = z/10)
609 chars
19 lines

In the above example, we first create sample data for x, y, and z columns. Then we create the scatter plot using plot() function and set the size of the markers using cex parameter. In this case, we divide z column by 10 to scale the size of the markers appropriately. Finally, we add labels to the plot including a legend for z column.

gistlibby LogSnag