I am trying to create a scatter plot with two y-axis variables against an x-axis variable, and am having a challenging time. The code I created only shows a blank graph with the x and y axis labeled.
This is my code created;
data1
attach(data1)
plot(Average.length_cm, Female, main = "Size at maturity", xlab = "Total length (cm)", ylab = "% Maturity", pch=12)
plot(x=Average.length_cm,
y=Female,
xlab='Total length (cm)',
ylab='% Maturity',
main='Size at maturity', xlim=c(0,12),
ylim=c(0,100))
plot(x=Average.length_cm,
y=Female,
xlab='Total lenght (cm)',
ylab='% Maturity',
main='Size at maturity', xlim=c(0,12),
ylim=c(0,100),
col='blue',
col.axis='black')
plot(data1[data1$Gender=='F',]$Average.length_cm,
data1[data1$Gender=='F',]$Female, xlab='Total length (cm)',
ylab='% Maturity', main='Size at maturity',
xlim=c(0,12), ylim=c(0,100), col='blue', col.axis='black',
pch=8)
par(new=TRUE)
plot(data1[data1$Gender=='M',]$Average.length_cm,
data1[data1$Gender=='M',]$Male, xlab='Total length (cm)',
ylab='% Maturity', main='Size at maturity',
xlim=c(0,12), ylim=c(0,100), col='red', col.axis='black',
pch=16)
Any advise?