Hello, i have been doing browns exponential smooting for myself and have a little trouble with plotting values: par(xpd=TRUE) plot(vector,xlab="Period",ylab="Values") legend(max(vector), legend = c("Original values", "Estimated values"), col=c("blue","red"),lwd=0.5, cex=1, xjust=0.1, yjust=-0.3) lines (vector, type = "o", col="blue") #original values lines (est_vector, type = "o", col="red") # estimated values lines (length(vector)+1,forecast, type = "o", col="green") #forecasted value i get result as in pdf file attached in this email. Two red values are "outside of frame" and i need also to get green value "inside of a frame".Can you help me? I am really stucked with this. thx! -------------- next part -------------- A non-text attachment was scrubbed... Name: Rplot.pdf Type: application/pdf Size: 4748 bytes Desc: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20121010/b86c66be/attachment-0002.pdf>
On 12-10-10 5:31 AM, piranha piranha wrote:> Hello, > > i have been doing browns exponential smooting for myself and have a little > trouble with plotting values: > > par(xpd=TRUE)The line above says "allow plotting outside the frame".> plot(vector,xlab="Period",ylab="Values") > legend(max(vector), legend = c("Original values", "Estimated values"), > col=c("blue","red"),lwd=0.5, cex=1, xjust=0.1, yjust=-0.3) > lines (vector, type = "o", col="blue") #original values > lines (est_vector, type = "o", col="red") # estimated values > lines (length(vector)+1,forecast, type = "o", col="green") #forecasted > value > > i get result as in pdf file attached in this email. > > Two red values are "outside of frame" and i need also to get green value > "inside of a frame".Can you help me? I am really stucked with this. thx!Don't include the par() call above. If you want to see those red values that fall below the frame, then use ylim in the original plot() call to set the limits, e.g. plot(..., ylim=range(c(vector, est_vector, forecast))) Duncan Murdoch
You could set xlim and slim when using plot() plot(vector,xlab="Period",ylab="Values",xlim=range(0,length(vector)+1),ylim=range(vector,est_vector,forecast)) i think - you forgot to provide data for the vectors :) On 10.10.2012, at 11:31, piranha piranha wrote:> Hello, > > i have been doing browns exponential smooting for myself and have a little > trouble with plotting values: > > par(xpd=TRUE) > plot(vector,xlab="Period",ylab="Values") > legend(max(vector), legend = c("Original values", "Estimated values"), > col=c("blue","red"),lwd=0.5, cex=1, xjust=0.1, yjust=-0.3) > lines (vector, type = "o", col="blue") #original values > lines (est_vector, type = "o", col="red") # estimated values > lines (length(vector)+1,forecast, type = "o", col="green") #forecasted > value > > i get result as in pdf file attached in this email. > > Two red values are "outside of frame" and i need also to get green value > "inside of a frame".Can you help me? I am really stucked with this. thx! > <Rplot.pdf>______________________________________________ > R-help at 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.