[R] Question re matplot
Marc Schwartz
marc_schwartz at comcast.net
Sun Oct 14 05:37:35 CEST 2007
On Sat, 2007-10-13 at 22:16 -0500, David Kaplan wrote:
> Yea, sorry, that was a typo when I copied into my emal.
>
> Here it is again
> matplot(battingagg$X, battingagg[, c("HR","RBI","X2B", "BB",
> "R", "SB")], type="b",lty=4,lwd=2, col=1:4,xlab = "Year",
> ylab = "(1)HRs, (2)RBIs, (3)DOUBLES,(4)BB,(5)Runs,(6) BB",
> pty="m",sub = "Figure 2. Plot of Selected Offensive
> Baseball Statistics: 1901 - 2005")
>
> David
<snip>
No problem. Just wanted to be sure that I wasn't missing something,
though I might have expected an error message of sorts.
As I don't have your data, I tried it with a single value:
battingagg <- data.frame(X = 1901:2005, HR = rep(20, 105))
matplot(battingagg$X, battingagg$HR, type="b",lty=4,lwd=2, col=1:4,xlab = "Year",
ylab = "(1)HRs, (2)RBIs, (3)DOUBLES,(4)BB,(5)Runs,(6) BB",
pty="m",sub = "Figure 2. Plot of Selected Offensive Baseball Statistics: 1901 - 2005")
This seems to work, so I am wondering if there is something in your
data. Can you post the results of summary(battingagg) to see if there
is something going on with the ranges of the values in aggregate, as
matplot() will by default, set the y axis to the range of all of the
data.
Alternatively, if you can post a smaller sample of the data that
replicates the problem, that would be better.
Marc
More information about the R-help
mailing list