Hi
I had a look at the help and previous discussions but I am
still unable to solve these issues:


1 I have a set of air pressure data. I would like to plot a and b (both about 980-1000 millibar) and c, the difference (around 0-8 millibar). I use axis (4) to create a new axis (to the right) but I do not know how to assign c to the new axis which currently features the same values as the first axis. So, how do I show a, b and c in the same plot with different scales (one for each y-axis)?


2 I would like the x-axis to be time (h): 04, 05, 06 ... 24, 01, 02 ... (the data is stored in the same table as a and b). How do define where to get data for the a-axis and show for example every 5th value along the axis? When I try plot (a ~ h ... the results are messed up in the plot.


3 Is there a way to define the color within the box in the plot?


I pasted my current code here: ----------------- # Import

a = read.table("pres.txt", header=TRUE)
b = read.table("pres.txt", header=TRUE)
h = read.table("pres.txt", header=TRUE)

a = (a[,2])
b = (b[,3])
c = abs(a-b)
h = (h[,1])

f = seq(980, 995, 2.5)

### Plot

par (mfrow=c(1,1)) # rows, columns
par (cex.lab=1, col.axis="black", bg="lightyellow", fg="black", mar=c(4, 4, 2.5, 2)) # cex sets font size



# Plot 1
plot (a, type="l", xlab="Time (h)", ylab="Temperature (�C)", ylim=c(980, 995), pch=1, col="red", lwd=2, tck=-0.01)
abline (h=f, lwd=1, lty=2)


lines(b, pch=3, col="blue", cex=2, type="l", lty=1, lwd=2) # lty controls line type
title("Air Pressure (mb)", font.main=1, adj=0.5, cex.main=2)



axis (4, labels=TRUE, tick=TRUE, col="black", tck=-0.01) lines(c, pch=3, col="green", cex=2, type="l", lty=5, lwd=2) -----------------



Best regards,

Magnus Nilsson, Sweden

______________________________________________
[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

Reply via email to