I want to plot 6 line graphs. I have 10 points 0.1, 0.2, 0.3, 0.4, 0.5, 0.6,As you are currently doing it, you are not specifying a x variable. This means you are getting an 'index plot'. If I understand what you want it would be simpler to just specify x in your plot statement. From there if you absolutely need EVERY 0.1 labeled you could suppress the axis and label by hand if you want. Something along the line of: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 variablesall 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 doesnot 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)
A =runif(10) B =runif(10) C =runif(10) D =runif(10) E =runif(10) F =runif(10) x = seq(0.1, 1.0, 0.1)plot(x, B, type="o", pch = 0, lty=1,col="blue", xlim = c(0,1), ylim = c(0,1),
xlab=expression(paste(lambda[0])),
ylab= expression(paste("Estimate of ", lambda[0])))
# Graph trucks with red dashed line and square points
lines(x, A, type="o", pch=2, lty=1, col="red")
lines(x, C, type="o", pch=3, lty=1, col="green")
lines(x, D, type="o", pch=4, lty=1, col="orange")
lines(x, E, type="o", pch=6, lty=1, col="brown")
lines(x, 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)
# 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)
Rob
# 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]] ______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.
------------------------------------------ Robert W. Baer, Ph.D. Professor of Physiology Kirksville College of Osteopathic Medicine A. T. Still University of Health Sciences 800 W. Jefferson St. Kirksville, MO 63501 660-626-2322 FAX 660-626-2965 ______________________________________________ [email protected] 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.

