Hello,
I want to plot 6 line graphs. I have 10 points 0.1, 0.2, 0.3, 0.4, 0.5, 0.6,
0.7, 0.8, 0.9 and 1.0.
At each point say 0.1, I have 6 variables A, B, C, D, E and F. The variables
all have values between 0 and 1 (and including 0 and 1). I also want to
label the x axis from 0.1 to 1.0 and the y axis from 0.1 to 1.0.
My goal is to plot a line graph representing the mean of the variables at
each level. SO for 0.1 on the xaxis, we should expect 6 values for y.
This is what I have so far. The plot omits 1.0 and the abline function does
not make the line y = x on the plot
This is what I have so far:

# Calculate range from 0 to max value of cars and trucks
g_range <- range(0, 1)

# Graph autos using y axis that ranges from 0 to max
# value in cars or trucks vector.  Turn off axes and
# annotations (axis labels) so we can specify them ourself
plot(B, type="o", pch = 0, lty=1,col="blue", ylim=g_range, axes=FALSE,
ann=FALSE)
# Make x axis using the values of pi_0 labels
#

axis(1, at=1:10,
lab=c("0.1","0.2","0.3","0.4","0.5","0.6","0.7","0.8","0.9","1.0"))

# Make y axis with horizontal labels that display ticks at
del = seq(0.1,1, 0.1)
axis(2, at=del,
lab=c("0.1","0.2","0.3","0.4","0.5","0.6","0.7","0.8","0.9","1.0"))

# Create box around plot
box()

# Graph trucks with red dashed line and square points
lines(A, type="o", pch=2, lty=1, col="red")
lines(C, type="o", pch=3, lty=1, col="green")
lines(D, type="o", pch=4, lty=1, col="orange")
lines(E, type="o", pch=6, lty=1, col="brown")
lines(F, type="o", pch=8, lty=1, col="yellow")
abline(0, 1, col = "black")
# Create a title with a red, bold/italic font
#title(main="Methods", col.main="red", font.main=4)

# Label the x and y axes
title(xlab=expression(paste(lambda[0])))
title(ylab= expression(paste("Estimate of ", lambda[0])))

# Create a legend at (1, g_range[2]) that is slightly smaller
# (cex) and uses the same line colors and points used by
# the actual plots
legend(1, g_range[2], c("B","A", "C", "D", "E", "F", "Actual"), cex=0.6,
col=c("blue","red", "green", "orange", "brown","yellow", "black"),
pch=c(0,2,3,4,6,8,9), lty=1)




-- 
Thanks,
Jim.

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to