Skip to content

Commit f0231ea

Browse files
Update code-scatter-plot.R
1 parent ccfffa0 commit f0231ea

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

plot/scatter-plot/code-scatter-plot.R

+15-5
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ missingdata <- aromatase[!complete.cases(aromatase), ] # Identify which row cont
1919
aromatase <- na.omit(aromatase) # Remove any missing data >> Complete case
2020
sum(is.na(aromatase)) # Check again for missing data
2121

22-
class <- aromatase[,2] # Class label
22+
class <- aromatase[ ,2] # Class label
2323
aromatase2 <- aromatase[,6:18] # Descriptors
2424
aromatase3 <- cbind(class, aromatase2) # Combine Class label + Descriptors into same dataframe
2525

@@ -65,7 +65,7 @@ plot(df$MW, df$ALogP, col = "#FF0000") # Hex color code for red
6565
rgb(1,0,0) # red color
6666
rgb(255,0,0, max=255) # red color
6767

68-
plot(df$MW, df$ALogP, col = rgb(255,0,0, max=255) )
68+
plot(df$MW, df$ALogP, col = rgb(0,0,0, max=255) )
6969

7070

7171

@@ -104,8 +104,8 @@ plot(df$MW, df$ALogP, pch = 16, col=alpha(as.character(df$color),0.3 ) )
104104
# Scatter plot of first pair
105105
plot(df$MW, df$ALogP, pch = 16,
106106
col = alpha("red", 0.3),
107-
xlab = "MW", # X-axis label
108-
ylab = "ALogP", # Y-axis label
107+
xlab = "Molecular Weight (MW)", # X-axis label
108+
ylab = "Solubility (ALogP)", # Y-axis label
109109
font.lab = 2 # X and Y labels are now bold
110110
)
111111
abline(lm(df$ALogP ~ df$MW)) # Trend line
@@ -197,7 +197,11 @@ abline(lm(df$HOMO ~ df$MW)) # Trend line
197197
pdf("plot.pdf")
198198
#...Insert plot function here...
199199
dev.off()
200-
200+
201+
pdf("plot.pdf")
202+
plot(df$ALogP, df$MW)
203+
dev.off()
204+
201205
# Multi-plot
202206

203207
pdf("plot2.pdf")
@@ -208,6 +212,12 @@ abline(lm(df$HOMO ~ df$MW)) # Trend line
208212
# Plot 4
209213
dev.off()
210214

215+
pdf("plot_multiplot.pdf")
216+
par(mfrow=c(1,3), mai = c(0.3, 0.3, 0.3, 0))
217+
plot(df$ALogP, df$MW) # Plot 1
218+
plot(df$Qm, df$MW) # Plot 2
219+
plot(df$HOMO, df$MW) # Plot 4
220+
dev.off()
211221

212222
pdf("plot2.pdf")
213223
par(mfrow=c(2,2), mai = c(0.7, 0.7, 0.3, 0.3))

0 commit comments

Comments
 (0)