Does this do what you want?


x <- "x.orig x.num y1 y2
a 1 0.2 0.4
b 2 0.1 0.1
c 3 0.3 0.3
d 4 0.3 0.15
e 5 0.1 0.05"
x.in <- read.table(textConnection(x), header=TRUE)
plot(x.in$y2, type='l', ylim=range(x.in$y1, x.in$y2), xaxt='n', col='red',
    xlab='', ylab='y')
lines(x.in$y1, lty=2, col='green')
axis(1, labels=as.character(x.in$x.orig), at=seq(nrow(x.in)))





On 2/24/07, Petar Milin <pmilin@gmail.com> wrote:
>
> Hello!
> Can anyone help me to build a graph with the alphanumeric values on
> x-axis, with two lines (preferably doted and solid, or similar) that
> present values on y-axes. In a toy example, data frame could be like
> this:
> x.orig x.num y1 y2
> a 1 0.2 0.4
> b 2 0.1 0.1
> c 3 0.3 0.3
> d 4 0.3 0.15
> e 5 0.1 0.05
>
> I can make graph only if I use values converted to numeric in "x.num",
> but not original "X.orig":
> matplot(dat$x.num, dat[, c("y1","y2")], type="b", lty=1, ylab="(1) y1,
> (2) y2")
>
> Also, how to make doted and solid instead of coloured lines?
>
> Thanks in advance. Sincerely,
> Petar M
>
> ______________________________________________
> R-help@stat.math.ethz.ch 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.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

	[[alternative HTML version deleted]]

