different values under the x axis labels

View: New views
2 Messages — Rating Filter:   Alert me  

different values under the x axis labels

by Luboš Behenský :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi everyone,
I am a complete beginner, no mathematician and I would like to ask You for help since this is my first experience with such a software like "R".

I have a .xls source file from 1 to 3600 seconds, each second has a noise level value. (attached in case you are interested)
Imported as "Dataset".
I would like to make a graph: Here is what I have been able to use:

par(mar = c(5, 4, 4, 2) + 0.1)
plot(Dataset, type="l", xlab="čas [s]", ylab= expression(paste("Hladina akustického tlaku","     ", bold(L[pA])," [dB]")), col="blue", xlim=c(0,3600), ylim=c(35,60), xaxs = "i", yaxs = "i",cex.main=1.5, cex.lab=1.2,xaxt="n")
abline(h=43,col="red",lwd=2)
title(main = "Místo příjmu 3, čas 9:00 - 10:00",font.main="2", line=3)
axis(3, xaxp=c(0, 3600, 12), mgp=c(3,0.6,0))
axis(1, xaxp=c(0, 3600, 12), mgp=c(3,0.6,0))
smartlegend(x="left", y="top",c(expression(paste(bold(L[eqA.1h]),bold(" [dB]"))), expression(paste(bold(L[pA]),bold(" [dB]")))),col=c("red","blue"), lty= 1:1,lwd=2, y.intersp= 1.1, bg="grey96",cex=1.1)

I succeeded in changing scale on both "X" after 300 seconds and now I would like to swap the value 300, 600, 900 (seconds)of the top axis to 5, 10, 15 (minutes) and so on OR
the best of all would be to have these numbers (minutes) under the original bottom x axis values in different color.


Thank you very much for any ideas.

Lubo



______________________________________________
R-help@... 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.

Re: different values under the x axis labels

by Robert Baer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have a .xls source file from 1 to 3600 seconds, each second has a noise
level value. (attached in case you are interested)
Imported as "Dataset".
I would like to make a graph: Here is what I have been able to use:

par(mar = c(5, 4, 4, 2) + 0.1)
plot(Dataset, type="l", xlab="čas [s]", ylab= expression(paste("Hladina
akustického tlaku","     ", bold(L[pA])," [dB]")), col="blue",
xlim=c(0,3600), ylim=c(35,60), xaxs = "i", yaxs = "i",cex.main=1.5,
cex.lab=1.2,xaxt="n")
abline(h=43,col="red",lwd=2)
title(main = "Místo příjmu 3, čas 9:00 - 10:00",font.main="2", line=3)
axis(3, xaxp=c(0, 3600, 12), mgp=c(3,0.6,0))
axis(1, xaxp=c(0, 3600, 12), mgp=c(3,0.6,0))
smartlegend(x="left", y="top",c(expression(paste(bold(L[eqA.1h]),bold("
[dB]"))), expression(paste(bold(L[pA]),bold(" [dB]")))),col=c("red","blue"),
lty= 1:1,lwd=2, y.intersp= 1.1, bg="grey96",cex=1.1)

I succeeded in changing scale on both "X" after 300 seconds and now I would
like to swap the value 300, 600, 900 (seconds)of the top axis to 5, 10, 15
(minutes) and so on OR
the best of all would be to have these numbers (minutes) under the original
bottom x axis values in different color.

Does this get you started?

Dataset=data.frame(time=1:3600,noise=15*abs(rnorm(3600)))
plot(Dataset, type="l", xlab="čas [s]", ylab= expression(paste("Hladina
akustického tlaku","     ", bold(L[pA])," [dB]")), col="blue",
xlim=c(0,3600), ylim=c(35,60), xaxs = "i", yaxs = "i",cex.main=1.5,
cex.lab=1.2,xaxt="n")
abline(h=43,col="red",lwd=2)
title(main = "Místo příjmu 3, čas 9:00 - 10:00",font.main="2", line=3)
# axis(3, xaxp=c(0, 3600, 12), mgp=c(3,0.6,0))
axis(3, at=seq(0,3600,300), labels=seq(0,60,5))
axis(1, xaxp=c(0, 3600, 12), mgp=c(3,0.6,0))


Rob

______________________________________________
R-help@... 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.