Load necessary packages

# install.packages("ggplot2")
# install.packages("ggpubr")
# install.packages("compbio4all")

Load necessary packages

library(ggplot2)
library(ggpubr)
library(compbio4all)

#Load dataframe

Can also create a dataframe with numeric data but for sake of ease, I have loaded a dataframe with numeric data already created

data(aa_dat)

Create two vectors with numeric data from dataframe

aa_mw <- aa_dat$MW.da
aa_volume <-aa_dat$volume

Take the log of each vector and create two new columns in data frame

aa_dat$MW.da.log <- log(aa_dat$MW.da)
aa_dat$volume.log <- log(aa_dat$volume)

Logical check to make sure both newly created columns have the same number of elements

length(aa_dat$MW.da.log) == length(aa_dat$volume.log)
## [1] TRUE

#Plot data using ggpubr Use the ggscatter function to plot the newly created columns with log values in the aa_dat dataframe. In this case we are plotting the log of the molecular weight of amino acids vs the log of the volume of the amino acids

ggscatter(y = "MW.da.log",
          x = "volume.log",
          data = aa_dat)